Class PackFile
- java.lang.Object
-
- java.io.File
-
- org.eclipse.jgit.internal.storage.file.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
-
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 fieldid
.private java.lang.String
getName(boolean isPreserved)
private java.lang.String
getName(PackExt ext)
PackExt
getPackExt()
Getter for the fieldpackExt
.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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
PREFIX
private static final java.lang.String PREFIX
- See Also:
- Constant Field Values
-
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
- theObjectId
for this packext
- thepackExt
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
- theid
(40 Hex char) section of the pack name.ext
- thepackExt
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 fieldid
.- Returns:
- the
id
(40 Hex char) section of the name.
-
getPackExt
public PackExt getPackExt()
Getter for the fieldpackExt
.- 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)
-
-