Iterable<PackIndex.MutableEntry>
public class PackFile extends Object implements Iterable<PackIndex.MutableEntry>
Modifier and Type | Field | Description |
---|---|---|
static Comparator<PackFile> |
SORT |
Sorts PackFiles to be most recently created to least recently created.
|
Constructor | Description |
---|---|
PackFile(File packFile,
int extensions) |
Construct a reader for an existing, pre-indexed packfile.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Close the resources utilized by this repository
|
PackIndex |
getIndex() |
|
File |
getPackFile() |
|
String |
getPackName() |
|
boolean |
hasObject(AnyObjectId id) |
Determine if an object is contained within the pack file.
|
Iterator<PackIndex.MutableEntry> |
iterator() |
Provide iterator over entries in associated pack index, that should also
exist in this pack file.
|
boolean |
shouldBeKept() |
Determines whether a .keep file exists for this pack file.
|
forEach, spliterator
public 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
IOException
public String getPackName()
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()
Iterator returns objects in SHA-1 lexicographical order.
iterator
in interface Iterable<PackIndex.MutableEntry>
PackIndex.iterator()
Copyright © 2018. All rights reserved.