org.eclipse.jgit.lib.ObjectId in a
org.eclipse.jgit.internal.storage.file.Pack .
Indexes are strictly redundant information in that we can rebuild all of the data held in the index file from the on disk representation of the pack file itself, but it is faster to access for random requests because data is stored by ObjectId.
| Modifier and Type | Class and Description |
|---|---|
| public abstract static class | PackIndex.
Base implementation of the iterator over index entries. |
| public static class | PackIndex.
Represent mutable entry of pack index consisting of object id and offset in pack (both mutable). |
| Modifier and Type | Method and Description |
|---|---|
| public default boolean | contains(AnyObjectId
the objectId to find id)Implements org. Returns true if the objectId is contained within the collection. |
| public long | Returns: CRC32 checksum of specified object (at 32 less significant bits)id of object to look for objId)Retrieve stored CRC32 checksum of the requested object raw-data (including header). |
| public long | Returns: offset of the object's header and compressed content; -1 if the object does not exist in this index and is thus not stored in the associated pack.name of the object to locate within the pack. objId)Locate the file offset position for the requested object. |
| public int | Returns: position of the object-id in the lexicographically ordered list of ids stored in this index; -1 if the object does not exist in this index and is thus not stored in the associated pack.name of the object to locate within the index objId)Locate the position of this id in the list of object-ids in the index |
| public byte[] | |
| public long | Returns: number of objects in this index, and likewise in the associated pack that this index was generated from.Obtain the total number of objects described by this index. |
| public ObjectId | Returns: the ObjectId for the corresponding entry.position within the traversal of nthPosition)iterator() that the
caller needs the object for. The first returned
org.
is 0, the second is 1, etc.Get ObjectId for the n-th object entry returned by |
| public default ObjectId | Returns: the ObjectId for the corresponding entry.unsigned 32 bit position within the traversal of
nthPosition)iterator() that the caller needs the object for. The
first returned
org.
is 0, the second is 1, etc. Positions past 2**31-1 are
negative, but still valid.Get ObjectId for the n-th object entry returned by |
| public long | Returns: the offset in a pack for the corresponding entry.unsigned 32 bit position within the traversal of
nthPosition)iterator() for which the caller needs the offset. The
first returned MutableEntry is 0, the second is 1,
etc. Positions past 2**31-1 are negative, but still valid.Get offset in a pack for the n-th object entry returned by
|
| public long | Returns: number of objects in this index using a 64 bit offset; that is an object positioned after the 2 GB position within the file.Obtain the total number of objects needing 64 bit offsets. |
| public boolean | Returns: true if CRC32 is stored, false otherwiseCheck whether this index supports (has) CRC32 checksums for objects. |
| public default boolean | Returns: true if the object is listed in this index; false otherwise.the object to look for. Must not be null. id)Determine if an object is contained within the pack file. |
| private static boolean | |
| public Iterator | |
| public static PackIndex | |
| public static PackIndex | Returns: a copy of the index in-memory.stream to read the index file from. The stream must be
buffered as some small IOs are performed against the stream.
The caller is responsible for closing the stream. fd)Read an existing pack index file from a buffered stream. |
| public void | resolve(Set<ObjectId>
set to add any located ObjectIds to. This is an output
parameter. matches, AbbreviatedObjectId prefix to search for. id, int maximum number of results to return. At most this many
ObjectIds should be added to matches before returning. matchLimit)Find objects matching the prefix abbreviation. |
| contains | back to summary |
|---|---|
| public default boolean contains(AnyObjectId id) Implements org. Doc from org. Returns true if the objectId is contained within the collection.
| |
| findCRC32 | back to summary |
|---|---|
| public long findCRC32(AnyObjectId objId) throws MissingObjectException, UnsupportedOperationException Retrieve stored CRC32 checksum of the requested object raw-data (including header).
| |
| findOffset | back to summary |
|---|---|
| public long findOffset(AnyObjectId objId) Locate the file offset position for the requested object.
| |
| findPosition | back to summary |
|---|---|
| public int findPosition(AnyObjectId objId) Locate the position of this id in the list of object-ids in the index
| |
| getChecksum | back to summary |
|---|---|
| public byte[] getChecksum() Get pack checksum
| |
| getObjectCount | back to summary |
|---|---|
| public long getObjectCount() Obtain the total number of objects described by this index.
| |
| getObjectId | back to summary |
|---|---|
| public ObjectId getObjectId(long nthPosition) Get ObjectId for the n-th object entry returned by This method is a constant-time replacement for the following loop: Iterator<MutableEntry> eItr = index.iterator(); int curPosition = 0; while (eItr.hasNext() && curPosition++ < nthPosition) eItr.next(); ObjectId result = eItr.next().toObjectId();
| |
| getObjectId | back to summary |
|---|---|
| public default ObjectId getObjectId(int nthPosition) Get ObjectId for the n-th object entry returned by This method is a constant-time replacement for the following loop: Iterator<MutableEntry> eItr = index.iterator(); int curPosition = 0; while (eItr.hasNext() && curPosition++ < nthPosition) eItr.next(); ObjectId result = eItr.next().toObjectId();
| |
| getOffset | back to summary |
|---|---|
| public long getOffset(long nthPosition) Get offset in a pack for the n-th object entry returned by
| |
| getOffset64Count | back to summary |
|---|---|
| public long getOffset64Count() Obtain the total number of objects needing 64 bit offsets.
| |
| hasCRC32Support | back to summary |
|---|---|
| public boolean hasCRC32Support() Check whether this index supports (has) CRC32 checksums for objects.
| |
| hasObject | back to summary |
|---|---|
| public default boolean hasObject(AnyObjectId id) Determine if an object is contained within the pack file.
| |
| isTOC | back to summary |
|---|---|
| private static boolean isTOC(byte[] h) | |
| iterator | back to summary |
|---|---|
| public Iterator Redeclares java. Doc from java. Returns an iterator over elements of type Provide iterator that gives access to index entries. Note, that iterator returns reference to mutable object, the same reference in each call - for performance reason. If client needs immutable objects, it must copy returned object on its own. Iterator returns objects in SHA-1 lexicographical order.
| |
| open | back to summary |
|---|---|
| public static PackIndex open(File idxFile) throws IOException Open an existing pack The format of the file will be automatically detected and a proper access implementation for that format will be constructed and returned to the caller. The file may or may not be held open by the returned instance.
| |
| read | back to summary |
|---|---|
| public static PackIndex read(InputStream fd) throws IOException, CorruptObjectException Read an existing pack index file from a buffered stream. The format of the file will be automatically detected and a proper access implementation for that format will be constructed and returned to the caller. The file may or may not be held open by the returned instance.
| |
| resolve | back to summary |
|---|---|
| public void resolve(Set<ObjectId> matches, AbbreviatedObjectId id, int matchLimit) throws IOException Find objects matching the prefix abbreviation.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final PackIndex. | |
| private final long | |
| private long | returnedNumber
Counts number of entries accessed so far. |
| Access | Constructor and Description |
|---|---|
| protected | EntriesIterator(long
the number of objects in the PackFile. objectCount)Construct an iterator that can move objectCount times forward. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public PackIndex. | next()
Implements java. Implementation must update |
| protected abstract void | |
| public void | remove()
Overrides default java. Removes from the underlying collection the last element returned by this iterator (optional operation). |
| protected void | setIdBuffer(int[]
the raw data raw, int the index into idx)rawCopies to the entry an |
| protected void | setIdBuffer(byte[]
the raw data raw, int the index into idx)rawCopies to the entry an |
| protected void |
| entry | back to summary |
|---|---|
| private final PackIndex. | |
| objectCount | back to summary |
|---|---|
| private final long objectCount | |
| returnedNumber | back to summary |
|---|---|
| private long returnedNumber Counts number of entries accessed so far. | |
| EntriesIterator | back to summary |
|---|---|
| protected EntriesIterator(long objectCount) Construct an iterator that can move objectCount times forward.
| |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public PackIndex. Implements java. Implementation must update
| |
| readNext | back to summary |
|---|---|
| protected abstract void readNext() Used by subclasses to load the next entry into the MutableEntry.
Subclasses are expected to populate the entry with
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
| |
| setIdBuffer | back to summary |
|---|---|
| protected void setIdBuffer(int[] raw, int idx) Copies to the entry an
| |
| setIdBuffer | back to summary |
|---|---|
| protected void setIdBuffer(byte[] raw, int idx) Copies to the entry an
| |
| setOffset | back to summary |
|---|---|
| protected void setOffset(long offset) Sets the
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final MutableObjectId | idBuffer
Buffer of the ObjectId visited by the EntriesIterator. |
| pack-priv long | offset
Offset into the packfile of the current object. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public PackIndex. | |
| public int | Returns: a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.Another mutable entry (probably from another index) otherSimilar to |
| public void | copyOidTo(MutableObjectId
destination for the object id dest)Copy the current ObjectId to dest
Like |
| public long | |
| public String | Returns: hex string describing the object id of this entry.Get hex string representation of the entry's object id |
| public ObjectId |
| idBuffer | back to summary |
|---|---|
| pack-priv final MutableObjectId idBuffer Buffer of the ObjectId visited by the EntriesIterator. | |
| offset | back to summary |
|---|---|
| pack-priv long offset Offset into the packfile of the current object. | |
| MutableEntry | back to summary |
|---|---|
| public MutableEntry() | |
| cloneEntry | back to summary |
|---|---|
| public PackIndex. Clone the entry
| |
| compareBySha1To | back to summary |
|---|---|
| public int compareBySha1To(PackIndex. Similar to
| |
| copyOidTo | back to summary |
|---|---|
| public void copyOidTo(MutableObjectId dest) Copy the current ObjectId to dest
Like
| |
| getOffset | back to summary |
|---|---|
| public long getOffset() Returns offset for this index object entry
| |
| name | back to summary |
|---|---|
| public String name() Get hex string representation of the entry's object id
| |
| toObjectId | back to summary |
|---|---|
| public ObjectId toObjectId() Create a copy of the object id
| |