public class PackFile extends Object implements Iterable<PackIndex.MutableEntry>
| Modifier and Type | Field and Description |
|---|---|
static Comparator<PackFile> |
SORT
Sorts PackFiles to be most recently created to least recently created.
|
| Constructor and Description |
|---|
PackFile(File packFile,
int extensions)
Construct a reader for an existing, pre-indexed packfile.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the resources utilized by this repository
|
PackIndex |
getIndex()
Get the index for this pack file.
|
File |
getPackFile()
Get the File object which locates this pack on disk.
|
String |
getPackName()
Get name extracted from
pack-*.pack pattern. |
boolean |
hasObject(AnyObjectId id)
Determine if an object is contained within the pack file.
|
Iterator<PackIndex.MutableEntry> |
iterator() |
boolean |
shouldBeKept()
Determines whether a .keep file exists for this pack file.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic static final Comparator<PackFile> SORT
public PackFile(File packFile, int extensions)
packFile - path of the .pack file holding the data.extensions - additional pack file extensions with the same base as the packpublic File getPackFile()
public PackIndex getIndex() throws IOException
IOExceptionpublic String getPackName()
pack-*.pack pattern.pack-*.pack pattern.public boolean hasObject(AnyObjectId id) throws IOException
For performance reasons only the index file is searched; the main pack content is ignored entirely.
id - the object to look for. Must not be null.IOException - the index file cannot be loaded into memory.public boolean shouldBeKept()
public void close()
public Iterator<PackIndex.MutableEntry> iterator()
Provide iterator over entries in associated pack index, that should also exist in this pack file. Objects returned by such iterator are mutable during iteration.
Iterator returns objects in SHA-1 lexicographical order.
iterator in interface Iterable<PackIndex.MutableEntry>PackIndex.iterator()Copyright © 2020 Eclipse JGit Project. All rights reserved.