java.lang.Object
org.eclipse.jgit.internal.storage.file.Pack
- All Implemented Interfaces:
Iterable<PackIndex.MutableEntry>
A Git version 2 pack file representation. A pack file contains Git objects in
delta packed format yielding high compression of lots of object where some
objects are similar.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<Pack>
Sorts PackFiles to be most recently created to least recently created. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the resources utilized by this repositorygetIndex()
Get the index for this pack file.Get the File object which locates this pack on disk.Get name extracted frompack-*.pack
pattern.boolean
hasObject
(AnyObjectId id) Determine if an object is contained within the pack file.iterator()
boolean
Determines whether a .keep file exists for this pack file.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
SORT
Sorts PackFiles to be most recently created to least recently created.
-
-
Constructor Details
-
Pack
Construct a reader for an existing, pre-indexed packfile.- Parameters:
cfg
- configuration this directory consults for write settings.packFile
- path of the.pack
file holding the data.bitmapIdxFile
- existing bitmap index file with the same base as the pack
-
-
Method Details
-
getPackFile
Get the File object which locates this pack on disk.- Returns:
- the File object which locates this pack on disk.
-
getIndex
Get the index for this pack file.- Returns:
- the index for this pack file.
- Throws:
IOException
- if an IO error occurred
-
getPackName
Get name extracted frompack-*.pack
pattern.- Returns:
- name extracted from
pack-*.pack
pattern.
-
hasObject
Determine if an object is contained within the pack file.For performance reasons only the index file is searched; the main pack content is ignored entirely.
- Parameters:
id
- the object to look for. Must not be null.- Returns:
- true if the object is in this pack; false otherwise.
- Throws:
IOException
- the index file cannot be loaded into memory.
-
shouldBeKept
public boolean shouldBeKept()Determines whether a .keep file exists for this pack file.- Returns:
- true if a .keep file exist.
-
close
public void close()Close the resources utilized by this repository -
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.
- Specified by:
iterator
in interfaceIterable<PackIndex.MutableEntry>
- See Also:
-
toString
-