Class PackFile

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<java.io.File>

    public class PackFile
    extends java.io.File
    A pack file (or pack related) File. Example: "pack-0123456789012345678901234567890123456789.idx"
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String base  
      private boolean hasOldPrefix  
      private java.lang.String id  
      private PackExt packExt  
      private static java.lang.String PREFIX  
      private static long serialVersionUID  
      • Fields inherited from class java.io.File

        pathSeparator, pathSeparatorChar, separator, separatorChar
    • Constructor Summary

      Constructors 
      Constructor Description
      PackFile​(java.io.File file)
      Create a PackFile for a pack or related file.
      PackFile​(java.io.File directory, java.lang.String name)
      Create a PackFile for a pack or related file.
      PackFile​(java.io.File directory, java.lang.String id, PackExt ext)
      Create a PackFile for a pack or related file.
      PackFile​(java.io.File directory, ObjectId id, PackExt ext)
      Create a PackFile for a pack or related file.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      PackFile create​(PackExt ext)
      Create a new similar PackFile with the given extension instead.
      PackFile createForDirectory​(java.io.File directory)
      Create a new similar PackFile in the given directory.
      private static java.lang.String createName​(java.lang.String id, PackExt extension)  
      PackFile createPreservedForDirectory​(java.io.File directory)
      Create a new similar preserved PackFile in the given directory.
      private java.lang.String getExtension()  
      private static java.lang.String getExtPrefix​(boolean isPreserved)  
      java.lang.String getId()
      Getter for the field id.
      private java.lang.String getName​(boolean isPreserved)  
      private java.lang.String getName​(PackExt ext)  
      PackExt getPackExt()
      Getter for the field packExt.
      private static PackExt getPackExt​(java.lang.String endsWithExtension)  
      • Methods inherited from class java.io.File

        canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURL
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • base

        private final java.lang.String base
      • id

        private final java.lang.String id
      • hasOldPrefix

        private final boolean hasOldPrefix
      • packExt

        private final PackExt packExt
    • Constructor Detail

      • PackFile

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

        public PackFile​(java.io.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​(java.io.File directory,
                        java.lang.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​(java.io.File directory,
                        java.lang.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 Detail

      • createName

        private static java.lang.String createName​(java.lang.String id,
                                                   PackExt extension)
      • getId

        public java.lang.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​(java.io.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​(java.io.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 java.lang.String getName​(PackExt ext)
      • getName

        private java.lang.String getName​(boolean isPreserved)
      • getExtension

        private java.lang.String getExtension()
      • getExtPrefix

        private static java.lang.String getExtPrefix​(boolean isPreserved)
      • getPackExt

        private static PackExt getPackExt​(java.lang.String endsWithExtension)