public class PackFile extends java.lang.Object implements java.lang.Iterable<PackIndex.MutableEntry>
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<PackFile> |
SORT
Sorts PackFiles to be most recently created to least recently created.
|
Constructor and Description |
---|
PackFile(java.io.File idxFile,
java.io.File packFile)
Construct a reader for an existing, pre-indexed packfile.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the resources utilized by this repository
|
java.io.File |
getPackFile() |
java.lang.String |
getPackName() |
boolean |
hasObject(AnyObjectId id)
Determine if an object is contained within the pack file.
|
java.util.Iterator<PackIndex.MutableEntry> |
iterator()
Provide iterator over entries in associated pack index, that should also
exist in this pack file.
|
public static final java.util.Comparator<PackFile> SORT
public PackFile(java.io.File idxFile, java.io.File packFile)
idxFile
- path of the .idx
file listing the contents.packFile
- path of the .pack
file holding the data.public java.io.File getPackFile()
public java.lang.String getPackName()
pack-*.pack
pattern.public boolean hasObject(AnyObjectId id) throws java.io.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.java.io.IOException
- the index file cannot be loaded into memory.public void close()
public java.util.Iterator<PackIndex.MutableEntry> iterator()
Iterator returns objects in SHA-1 lexicographical order.
iterator
in interface java.lang.Iterable<PackIndex.MutableEntry>
PackIndex.iterator()
Copyright © 2012. All Rights Reserved.