Top Description Fields Constructors Methods
org.eclipse.jgit.internal.storage.file

public Class PackFile

extends File
Class Inheritance
Imports
java.io.File, java.text.MessageFormat, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.internal.storage.pack.PackExt, org.eclipse.jgit.lib.ObjectId

A pack file (or pack related) File. Example: "pack-0123456789012345678901234567890123456789.idx"

Field Summary

Modifier and TypeField and Description
private final String
private final boolean
private final String
private final PackExt
private static final String
private static final long
private static final String
Inherited from java.io.File:
pathSeparatorpathSeparatorCharseparatorseparatorChar

Constructor Summary

AccessConstructor and Description
public
PackFile(File
File pointing to the location of the file.
file
)

Create a PackFile for a pack or related file.

public
PackFile(File
Directory to create the PackFile in.
directory
,
ObjectId
the ObjectId for this pack
id
,
PackExt
the packExt of the name.
ext
)

Create a PackFile for a pack or related file.

public
PackFile(File
Directory to create the PackFile in.
directory
,
String
the id (40 Hex char) section of the pack name.
id
,
PackExt
the packExt of the name.
ext
)

Create a PackFile for a pack or related file.

public
PackFile(File
Directory to create the PackFile in.
directory
,
String
Filename (last path section) of the PackFile
name
)

Create a PackFile for a pack or related file.

Method Summary

Modifier and TypeMethod and Description
public PackFile

Returns:

a PackFile instance with specified extension
create
(PackExt
PackExt the extension to use.
ext
)

Create a new similar PackFile with the given extension instead.

public PackFile

Returns:

a PackFile in the given directory
createForDirectory
(File
Directory to create the new PackFile in.
directory
)

Create a new similar PackFile in the given directory.

private static String
createName(String id, PackExt extension)

public PackFile

Returns:

a PackFile in the given directory with "old-" prefixing the extension
createPreservedForDirectory
(File
Directory to create the new PackFile in.
directory
)

Create a new similar preserved PackFile in the given directory.

private String
private static String
getExtPrefix(boolean isPreserved)

public String

Returns:

the id (40 Hex char) section of the name.
getId
()

Getter for the field id.

private String
private String
getName(boolean isPreserved)

public PackExt

Returns:

the packExt of the name.
getPackExt
()

Getter for the field packExt.

private static PackExt
getPackExt(String endsWithExtension)

public boolean

Returns:

whether the file is a temporary GC file
isTmpGCFile
()

Inherited from java.io.File:
canExecutecanReadcanWritecompareTocreateNewFilecreateTempFilecreateTempFiledeletedeleteOnExitequalsexistsgetAbsoluteFilegetAbsolutePathgetCanonicalFilegetCanonicalPathgetFreeSpacegetNamegetParentgetParentFilegetPathgetTotalSpacegetUsableSpacehashCodeisAbsoluteisDirectoryisFileisHiddenlastModifiedlengthlistlistlistFileslistFileslistFileslistRootsmkdirmkdirsrenameTosetExecutablesetExecutablesetLastModifiedsetReadablesetReadablesetReadOnlysetWritablesetWritabletoPathtoStringtoURItoURL

Field Detail

baseback to summary
private final String base
hasOldPrefixback to summary
private final boolean hasOldPrefix
idback to summary
private final String id
packExtback to summary
private final PackExt packExt
PREFIXback to summary
private static final String PREFIX
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.io.File.serialVersionUID.

TMP_GC_PREFIXback to summary
private static final String TMP_GC_PREFIX

Constructor Detail

PackFileback to summary
public PackFile(File file)

Create a PackFile for a pack or related file.

Parameters
file:File

File pointing to the location of the file.

PackFileback to summary
public PackFile(File directory, ObjectId id, PackExt ext)

Create a PackFile for a pack or related file.

Parameters
directory:File

Directory to create the PackFile in.

id:ObjectId

the ObjectId for this pack

ext:PackExt

the packExt of the name.

PackFileback to summary
public PackFile(File directory, String id, PackExt ext)

Create a PackFile for a pack or related file.

Parameters
directory:File

Directory to create the PackFile in.

id:String

the id (40 Hex char) section of the pack name.

ext:PackExt

the packExt of the name.

PackFileback to summary
public PackFile(File directory, String name)

Create a PackFile for a pack or related file.

Parameters
directory:File

Directory to create the PackFile in.

name:String

Filename (last path section) of the PackFile

Method Detail

createback to summary
public PackFile create(PackExt ext)

Create a new similar PackFile with the given extension instead.

Parameters
ext:PackExt

PackExt the extension to use.

Returns:PackFile

a PackFile instance with specified extension

createForDirectoryback to summary
public PackFile createForDirectory(File directory)

Create a new similar PackFile in the given directory.

Parameters
directory:File

Directory to create the new PackFile in.

Returns:PackFile

a PackFile in the given directory

createNameback to summary
private static String createName(String id, PackExt extension)
createPreservedForDirectoryback to summary
public PackFile createPreservedForDirectory(File directory)

Create a new similar preserved PackFile in the given directory.

Parameters
directory:File

Directory to create the new PackFile in.

Returns:PackFile

a PackFile in the given directory with "old-" prefixing the extension

getExtensionback to summary
private String getExtension()
getExtPrefixback to summary
private static String getExtPrefix(boolean isPreserved)
getIdback to summary
public String getId()

Getter for the field id.

Returns:String

the id (40 Hex char) section of the name.

getNameback to summary
private String getName(PackExt ext)
getNameback to summary
private String getName(boolean isPreserved)
getPackExtback to summary
public PackExt getPackExt()

Getter for the field packExt.

Returns:PackExt

the packExt of the name.

getPackExtback to summary
private static PackExt getPackExt(String endsWithExtension)
isTmpGCFileback to summary
public boolean isTmpGCFile()
Returns:boolean

whether the file is a temporary GC file