Class PackFile

java.lang.Object
java.io.File
org.eclipse.jgit.internal.storage.file.PackFile
All Implemented Interfaces:
Serializable, Comparable<File>

public class PackFile extends File
A pack file (or pack related) File. Example: "pack-0123456789012345678901234567890123456789.idx"
See Also:
  • Field Details

  • Constructor Details

    • PackFile

      public PackFile(File file)
      Create a PackFile for a pack or related file.
      Parameters:
      file - File pointing to the location of the file.
    • PackFile

      public PackFile(File directory, ObjectId id, PackExt ext)
      Create a PackFile for a pack or related file.
      Parameters:
      directory - Directory to create the PackFile in.
      id - the ObjectId for this pack
      ext - the packExt of the name.
    • PackFile

      public PackFile(File directory, String id, PackExt ext)
      Create a PackFile for a pack or related file.
      Parameters:
      directory - Directory to create the PackFile in.
      id - the id (40 Hex char) section of the pack name.
      ext - the packExt of the name.
    • PackFile

      public PackFile(File directory, String name)
      Create a PackFile for a pack or related file.
      Parameters:
      directory - Directory to create the PackFile in.
      name - Filename (last path section) of the PackFile
  • Method Details

    • createName

      private static String createName(String id, PackExt extension)
    • getId

      public String getId()
      Getter for the field id.
      Returns:
      the id (40 Hex char) section of the name.
    • getPackExt

      public PackExt getPackExt()
      Getter for the field packExt.
      Returns:
      the packExt of the name.
    • create

      public PackFile create(PackExt ext)
      Create a new similar PackFile with the given extension instead.
      Parameters:
      ext - PackExt the extension to use.
      Returns:
      a PackFile instance with specified extension
    • createForDirectory

      public PackFile createForDirectory(File directory)
      Create a new similar PackFile in the given directory.
      Parameters:
      directory - Directory to create the new PackFile in.
      Returns:
      a PackFile in the given directory
    • createPreservedForDirectory

      public PackFile createPreservedForDirectory(File directory)
      Create a new similar preserved PackFile in the given directory.
      Parameters:
      directory - Directory to create the new PackFile in.
      Returns:
      a PackFile in the given directory with "old-" prefixing the extension
    • getName

      private String getName(PackExt ext)
    • getName

      private String getName(boolean isPreserved)
    • getExtension

      private String getExtension()
    • getExtPrefix

      private static String getExtPrefix(boolean isPreserved)
    • getPackExt

      private static PackExt getPackExt(String endsWithExtension)