Top Description Inners Fields Constructors Methods
org.eclipse.jgit.lib

public abstract Class ObjectReader

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Known Direct Subclasses
org.eclipse.jgit.lib.ObjectReader.Filter, org.eclipse.jgit.internal.storage.dfs.DfsInserter.Reader, org.eclipse.jgit.internal.storage.dfs.DfsReader, org.eclipse.jgit.internal.storage.file.WindowCursor, org.eclipse.jgit.internal.storage.file.PackInserter.Reader
Static Imports
org.eclipse.jgit.lib.Constants.OBJECT_ID_ABBREV_STRING_LENGTH

Reads an org.eclipse.jgit.lib.ObjectDatabase for a single thread.

Readers that can support efficient reuse of pack encoded objects should also implement the companion interface org.eclipse.jgit.internal.storage.pack.ObjectReuseAsIs.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
ObjectReader.Filter

Wraps a delegate ObjectReader.

Field Summary

Modifier and TypeField and Description
public static final int
OBJ_ANY

Type hint indicating the caller doesn't know the type.

protected int
streamFileThreshold

The threshold at which a file will be streamed rather than loaded entirely into memory.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public AbbreviatedObjectId

Returns:

SHA-1 abbreviation.
abbreviate
(AnyObjectId
object identity that needs to be abbreviated.
objectId
)

Obtain a unique abbreviation (prefix) of an object SHA-1.

public AbbreviatedObjectId

Returns:

SHA-1 abbreviation. If no matching objects exist in the repository, the abbreviation will match the minimum length.
abbreviate
(AnyObjectId
object identity that needs to be abbreviated.
objectId
,
int
minimum length of the abbreviated string. Must be in the range [2, 40].
len
)

Obtain a unique abbreviation (prefix) of an object SHA-1.

public abstract void
close()

Redeclares java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

public ObjectReachabilityChecker

Returns:

the most efficient object reachability checker for this repository.
createObjectReachabilityChecker
(ObjectWalk
objectwalk for use by the reachability checker
ow
)

Create an object reachability checker that will use bitmaps if possible.

public ReachabilityChecker

Returns:

the most efficient reachability checker for this repository.
createReachabilityChecker
(RevWalk
revwalk for use by the reachability checker
rw
)

Create a reachability checker that will use bitmaps if possible.

public BitmapIndex

Returns:

the index or null if one does not exist.
getBitmapIndex
()

An index that can be used to speed up ObjectWalks.

public Optional<CommitGraph>

Returns:

the commit-graph or empty if the commit-graph does not exist or is invalid; always returns empty when core.commitGraph is false (default is false).
getCommitGraph
()

Get the commit-graph for this repository if available.

public ObjectInserter

Returns:

the org.eclipse.jgit.lib.ObjectInserter from which this reader was created using inserter.newReader(), or null if this reader was not created from an inserter.
getCreatedFromInserter
()

Get the org.eclipse.jgit.lib.ObjectInserter from which this reader was created using inserter.newReader()

public long

Returns:

size of object in bytes.
getObjectSize
(AnyObjectId
identity of the object to open.
objectId
,
int
hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.
typeHint
)

Get only the size of an object.

public <
type of ObjectId
T extends ObjectId
>
AsyncObjectSizeQueue<T>

Returns:

queue to read object sizes from.
getObjectSize
(Iterable<T>
objects to get the size of from the object store. The supplied collection must not be modified until the queue has finished.
objectIds
,
final boolean
if true missing objects are reported by calling failure with a MissingObjectException. This may be more expensive for the implementation to guarantee. If false the implementation may choose to report MissingObjectException, or silently skip over the object with no warning.
reportMissing
)

Asynchronous object size lookup.

public abstract Set<ObjectId>

Returns:

IDs of shallow commits
getShallowCommits
()

Returns IDs for those commits which should be considered as shallow.

public int

Returns:

the threshold in bytes
getStreamFileThreshold
()

Returns the threshold at which a file will be streamed rather than loaded entirely into memory

public boolean

Returns:

true if the specified object is stored in this database.
has
(AnyObjectId
identity of the object to test for existence of.
objectId
)

Does the requested object exist in this database?

public boolean

Returns:

true if the specified object is stored in this database.
has
(AnyObjectId
identity of the object to test for existence of.
objectId
,
int
hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.
typeHint
)

Does the requested object exist in this database?

public boolean

Returns:

true if the object size is equal or smaller than the threshold value
isNotLargerThan
(AnyObjectId
identity of the object to open.
objectId
,
int
hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.
typeHint
,
long
threshold value for the size of the object in bytes.
size
)

Check if the object size is less or equal than certain value By default, it reads the object from storage to get the size.

public abstract ObjectReader

Returns:

a brand new reader, using the same data source.
newReader
()

Construct a new reader from the same data.

public ObjectLoader

Returns:

a org.eclipse.jgit.lib.ObjectLoader for accessing the object.
open
(AnyObjectId
identity of the object to open.
objectId
)

Open an object from this database.

public abstract ObjectLoader

Returns:

a org.eclipse.jgit.lib.ObjectLoader for accessing the object.
open
(AnyObjectId
identity of the object to open.
objectId
,
int
hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.
typeHint
)

Open an object from this database.

public <
type of ObjectId
T extends ObjectId
>
AsyncObjectLoaderQueue<T>

Returns:

queue to read the objects from.
open
(Iterable<T>
objects to open from the object store. The supplied collection must not be modified until the queue has finished.
objectIds
,
final boolean
if true missing objects are reported by calling failure with a MissingObjectException. This may be more expensive for the implementation to guarantee. If false the implementation may choose to report MissingObjectException, or silently skip over the object with no warning.
reportMissing
)

Asynchronous object opening.

public abstract Collection<ObjectId>

Returns:

candidates that begin with the abbreviated identity.
resolve
(AbbreviatedObjectId
abbreviated id to resolve to a complete identity. The abbreviation must have a length of at least 2.
id
)

Resolve an abbreviated ObjectId to its full form.

public void
setAvoidUnreachableObjects(boolean
true to avoid unreachable objects.
avoid
)

Advise the reader to avoid unreachable objects.

public void
setStreamFileThreshold(int
the new threshold
threshold
)

Sets the threshold at which a file will be streamed rather than loaded entirely into memory

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

OBJ_ANYback to summary
public static final int OBJ_ANY

Type hint indicating the caller doesn't know the type.

streamFileThresholdback to summary
protected int streamFileThreshold

The threshold at which a file will be streamed rather than loaded entirely into memory.

Since
4.6

Constructor Detail

ObjectReaderback to summary
public ObjectReader()

Method Detail

abbreviateback to summary
public AbbreviatedObjectId abbreviate(AnyObjectId objectId) throws IOException

Obtain a unique abbreviation (prefix) of an object SHA-1. This method uses a reasonable default for the minimum length. Callers who don't care about the minimum length should prefer this method. The returned abbreviation would expand back to the argument ObjectId when passed to resolve(AbbreviatedObjectId), assuming no new objects are added to this repository between calls.

Parameters
objectId:AnyObjectId

object identity that needs to be abbreviated.

Returns:AbbreviatedObjectId

SHA-1 abbreviation.

Exceptions
IOException:
the object store cannot be read.
abbreviateback to summary
public AbbreviatedObjectId abbreviate(AnyObjectId objectId, int len) throws IOException

Obtain a unique abbreviation (prefix) of an object SHA-1. The returned abbreviation would expand back to the argument ObjectId when passed to resolve(AbbreviatedObjectId), assuming no new objects are added to this repository between calls. The default implementation of this method abbreviates the id to the minimum length, then resolves it to see if there are multiple results. When multiple results are found, the length is extended by 1 and resolve is tried again.

Parameters
objectId:AnyObjectId

object identity that needs to be abbreviated.

len:int

minimum length of the abbreviated string. Must be in the range [2, 40].

Returns:AbbreviatedObjectId

SHA-1 abbreviation. If no matching objects exist in the repository, the abbreviation will match the minimum length.

Exceptions
IOException:
the object store cannot be read.
closeback to summary
public abstract void close()

Redeclares java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Release any resources used by this reader.

A reader that has been released can be used again, but may need to be released after the subsequent usage.

Annotations
@Override
Since
4.0
createObjectReachabilityCheckerback to summary
public ObjectReachabilityChecker createObjectReachabilityChecker(ObjectWalk ow) throws IOException

Create an object reachability checker that will use bitmaps if possible. This reachability checker accepts any object as target. For checks exclusively between commits, use createReachabilityChecker(RevWalk).

Parameters
ow:ObjectWalk

objectwalk for use by the reachability checker

Returns:ObjectReachabilityChecker

the most efficient object reachability checker for this repository.

Annotations
@NonNull
Exceptions
IOException:
if it cannot open any of the underlying indices.
Since
5.11
createReachabilityCheckerback to summary
public ReachabilityChecker createReachabilityChecker(RevWalk rw) throws IOException

Create a reachability checker that will use bitmaps if possible.

Parameters
rw:RevWalk

revwalk for use by the reachability checker

Returns:ReachabilityChecker

the most efficient reachability checker for this repository.

Annotations
@NonNull
Exceptions
IOException:
if it cannot open any of the underlying indices.
Since
5.11
getBitmapIndexback to summary
public BitmapIndex getBitmapIndex() throws IOException

An index that can be used to speed up ObjectWalks.

Returns:BitmapIndex

the index or null if one does not exist.

Exceptions
IOException:
when the index fails to load
Since
3.0
getCommitGraphback to summary
public Optional<CommitGraph> getCommitGraph() throws IOException

Get the commit-graph for this repository if available.

The commit graph can be created/modified/deleted while the repository is open and specific implementations decide when to refresh it.

Returns:Optional<CommitGraph>

the commit-graph or empty if the commit-graph does not exist or is invalid; always returns empty when core.commitGraph is false (default is false).

Exceptions
IOException:
if it cannot open any of the underlying commit graph.
Since
6.5
getCreatedFromInserterback to summary
public ObjectInserter getCreatedFromInserter()

Get the org.eclipse.jgit.lib.ObjectInserter from which this reader was created using inserter.newReader()

Returns:ObjectInserter

the org.eclipse.jgit.lib.ObjectInserter from which this reader was created using inserter.newReader(), or null if this reader was not created from an inserter.

Annotations
@Nullable
Since
4.4
getObjectSizeback to summary
public long getObjectSize(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException

Get only the size of an object.

The default implementation of this method opens an ObjectLoader. Databases are encouraged to override this if a faster access method is available to them.

Parameters
objectId:AnyObjectId

identity of the object to open.

typeHint:int

hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.

Returns:long

size of object in bytes.

Exceptions
MissingObjectException:
the object does not exist.
IncorrectObjectTypeException:
typeHint was not OBJ_ANY, and the object's actual type does not match typeHint.
IOException:
the object store cannot be accessed.
getObjectSizeback to summary
public <T extends ObjectId> AsyncObjectSizeQueue<T> getObjectSize(Iterable<T> objectIds, final boolean reportMissing)

Asynchronous object size lookup.

Parameters
<T>
type of ObjectId
objectIds:Iterable<T>

objects to get the size of from the object store. The supplied collection must not be modified until the queue has finished.

reportMissing:boolean

if true missing objects are reported by calling failure with a MissingObjectException. This may be more expensive for the implementation to guarantee. If false the implementation may choose to report MissingObjectException, or silently skip over the object with no warning.

Returns:AsyncObjectSizeQueue<T>

queue to read object sizes from.

getShallowCommitsback to summary
public abstract Set<ObjectId> getShallowCommits() throws IOException

Returns IDs for those commits which should be considered as shallow.

Returns:Set<ObjectId>

IDs of shallow commits

Exceptions
IOException:
if an error occurred
getStreamFileThresholdback to summary
public int getStreamFileThreshold()

Returns the threshold at which a file will be streamed rather than loaded entirely into memory

Returns:int

the threshold in bytes

Since
4.6
hasback to summary
public boolean has(AnyObjectId objectId) throws IOException

Does the requested object exist in this database?

Parameters
objectId:AnyObjectId

identity of the object to test for existence of.

Returns:boolean

true if the specified object is stored in this database.

Exceptions
IOException:
the object store cannot be accessed.
hasback to summary
public boolean has(AnyObjectId objectId, int typeHint) throws IOException

Does the requested object exist in this database?

Parameters
objectId:AnyObjectId

identity of the object to test for existence of.

typeHint:int

hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.

Returns:boolean

true if the specified object is stored in this database.

Exceptions
IOException:
the object store cannot be accessed.
IncorrectObjectTypeException:
typeHint was not OBJ_ANY, and the object's actual type does not match typeHint.
isNotLargerThanback to summary
public boolean isNotLargerThan(AnyObjectId objectId, int typeHint, long size) throws MissingObjectException, IncorrectObjectTypeException, IOException

Check if the object size is less or equal than certain value By default, it reads the object from storage to get the size. Subclasses can implement more efficient lookups.

Parameters
objectId:AnyObjectId

identity of the object to open.

typeHint:int

hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.

size:long

threshold value for the size of the object in bytes.

Returns:boolean

true if the object size is equal or smaller than the threshold value

Exceptions
MissingObjectException:
the object does not exist.
IncorrectObjectTypeException:
typeHint was not OBJ_ANY, and the object's actual type does not match typeHint.
IOException:
the object store cannot be accessed.
Since
6.4
newReaderback to summary
public abstract ObjectReader newReader()

Construct a new reader from the same data.

Applications can use this method to build a new reader from the same data source, but for an different thread.

Returns:ObjectReader

a brand new reader, using the same data source.

openback to summary
public ObjectLoader open(AnyObjectId objectId) throws MissingObjectException, IOException

Open an object from this database.

Parameters
objectId:AnyObjectId

identity of the object to open.

Returns:ObjectLoader

a org.eclipse.jgit.lib.ObjectLoader for accessing the object.

Exceptions
MissingObjectException:
the object does not exist.
IOException:
the object store cannot be accessed.
openback to summary
public abstract ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException

Open an object from this database.

Parameters
objectId:AnyObjectId

identity of the object to open.

typeHint:int

hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.

Returns:ObjectLoader

a org.eclipse.jgit.lib.ObjectLoader for accessing the object.

Exceptions
MissingObjectException:
the object does not exist.
IncorrectObjectTypeException:
typeHint was not OBJ_ANY, and the object's actual type does not match typeHint.
IOException:
the object store cannot be accessed.
openback to summary
public <T extends ObjectId> AsyncObjectLoaderQueue<T> open(Iterable<T> objectIds, final boolean reportMissing)

Asynchronous object opening.

Parameters
<T>
type of ObjectId
objectIds:Iterable<T>

objects to open from the object store. The supplied collection must not be modified until the queue has finished.

reportMissing:boolean

if true missing objects are reported by calling failure with a MissingObjectException. This may be more expensive for the implementation to guarantee. If false the implementation may choose to report MissingObjectException, or silently skip over the object with no warning.

Returns:AsyncObjectLoaderQueue<T>

queue to read the objects from.

resolveback to summary
public abstract Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException

Resolve an abbreviated ObjectId to its full form. This method searches for an ObjectId that begins with the abbreviation, and returns at least some matching candidates. If the returned collection is empty, no objects start with this abbreviation. The abbreviation doesn't belong to this repository, or the repository lacks the necessary objects to complete it. If the collection contains exactly one member, the abbreviation is (currently) unique within this database. There is a reasonably high probability that the returned id is what was previously abbreviated. If the collection contains 2 or more members, the abbreviation is not unique. In this case the implementation is only required to return at least 2 candidates to signal the abbreviation has conflicts. User friendly implementations should return as many candidates as reasonably possible, as the caller may be able to disambiguate further based on context. However since databases can be very large (e.g. 10 million objects) returning 625,000 candidates for the abbreviation "0" is simply unreasonable, so implementors should draw the line at around 256 matches.

Parameters
id:AbbreviatedObjectId

abbreviated id to resolve to a complete identity. The abbreviation must have a length of at least 2.

Returns:Collection<ObjectId>

candidates that begin with the abbreviated identity.

Exceptions
IOException:
the object store cannot be read.
setAvoidUnreachableObjectsback to summary
public void setAvoidUnreachableObjects(boolean avoid)

Advise the reader to avoid unreachable objects.

While enabled the reader will skip over anything previously proven to be unreachable. This may be dangerous in the face of concurrent writes.

Parameters
avoid:boolean

true to avoid unreachable objects.

Since
3.0
setStreamFileThresholdback to summary
public void setStreamFileThreshold(int threshold)

Sets the threshold at which a file will be streamed rather than loaded entirely into memory

Parameters
threshold:int

the new threshold

Since
4.6
org.eclipse.jgit.lib back to summary

public abstract Class ObjectReader.Filter

extends ObjectReader
Class Inheritance

Wraps a delegate ObjectReader.
Since
4.4

Field Summary

Inherited from org.eclipse.jgit.lib.ObjectReader:
OBJ_ANYstreamFileThreshold

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public AbbreviatedObjectId
abbreviate(AnyObjectId
object identity that needs to be abbreviated.
objectId
)

Overrides org.eclipse.jgit.lib.ObjectReader.abbreviate.

Obtain a unique abbreviation (prefix) of an object SHA-1.

public AbbreviatedObjectId
abbreviate(AnyObjectId
object identity that needs to be abbreviated.
objectId
,
int
minimum length of the abbreviated string. Must be in the range [2, 40].
len
)

Overrides org.eclipse.jgit.lib.ObjectReader.abbreviate.

Obtain a unique abbreviation (prefix) of an object SHA-1.

public void
close()

Implements abstract org.eclipse.jgit.lib.ObjectReader.close.

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

protected abstract ObjectReader

Returns:

delegate ObjectReader to handle all processing.
delegate
()

Get delegate ObjectReader to handle all processing

public BitmapIndex
getBitmapIndex()

Overrides org.eclipse.jgit.lib.ObjectReader.getBitmapIndex.

An index that can be used to speed up ObjectWalks.

public Optional<CommitGraph>
getCommitGraph()

Overrides org.eclipse.jgit.lib.ObjectReader.getCommitGraph.

Get the commit-graph for this repository if available.

public ObjectInserter
getCreatedFromInserter()

Overrides org.eclipse.jgit.lib.ObjectReader.getCreatedFromInserter.

Get the org.eclipse.jgit.lib.ObjectInserter from which this reader was created using inserter.newReader()

public long
getObjectSize(AnyObjectId
identity of the object to open.
objectId
,
int
hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.
typeHint
)

Overrides org.eclipse.jgit.lib.ObjectReader.getObjectSize.

Get only the size of an object.

public <T extends ObjectId> AsyncObjectSizeQueue<T>
getObjectSize(Iterable<T>
objects to get the size of from the object store. The supplied collection must not be modified until the queue has finished.
objectIds
,
boolean
if true missing objects are reported by calling failure with a MissingObjectException. This may be more expensive for the implementation to guarantee. If false the implementation may choose to report MissingObjectException, or silently skip over the object with no warning.
reportMissing
)

Overrides org.eclipse.jgit.lib.ObjectReader.getObjectSize.

Asynchronous object size lookup.

public Set<ObjectId>
getShallowCommits()

Implements abstract org.eclipse.jgit.lib.ObjectReader.getShallowCommits.

Returns IDs for those commits which should be considered as shallow.

public boolean
has(AnyObjectId
identity of the object to test for existence of.
objectId
)

Overrides org.eclipse.jgit.lib.ObjectReader.has.

Does the requested object exist in this database?

public boolean
has(AnyObjectId
identity of the object to test for existence of.
objectId
,
int
hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.
typeHint
)

Overrides org.eclipse.jgit.lib.ObjectReader.has.

Does the requested object exist in this database?

public ObjectReader
newReader()

Implements abstract org.eclipse.jgit.lib.ObjectReader.newReader.

Construct a new reader from the same data.

public ObjectLoader
open(AnyObjectId
identity of the object to open.
objectId
)

Overrides org.eclipse.jgit.lib.ObjectReader.open.

Open an object from this database.

public ObjectLoader
open(AnyObjectId
identity of the object to open.
objectId
,
int
hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.
typeHint
)

Implements abstract org.eclipse.jgit.lib.ObjectReader.open.

Open an object from this database.

public <T extends ObjectId> AsyncObjectLoaderQueue<T>
open(Iterable<T>
objects to open from the object store. The supplied collection must not be modified until the queue has finished.
objectIds
,
boolean
if true missing objects are reported by calling failure with a MissingObjectException. This may be more expensive for the implementation to guarantee. If false the implementation may choose to report MissingObjectException, or silently skip over the object with no warning.
reportMissing
)

Overrides org.eclipse.jgit.lib.ObjectReader.open.

Asynchronous object opening.

public Collection<ObjectId>
resolve(AbbreviatedObjectId
abbreviated id to resolve to a complete identity. The abbreviation must have a length of at least 2.
id
)

Implements abstract org.eclipse.jgit.lib.ObjectReader.resolve.

Resolve an abbreviated ObjectId to its full form.

public void
setAvoidUnreachableObjects(boolean
true to avoid unreachable objects.
avoid
)

Overrides org.eclipse.jgit.lib.ObjectReader.setAvoidUnreachableObjects.

Advise the reader to avoid unreachable objects.

Inherited from org.eclipse.jgit.lib.ObjectReader:
createObjectReachabilityCheckercreateReachabilityCheckergetStreamFileThresholdisNotLargerThansetStreamFileThreshold

Constructor Detail

Filterback to summary
public Filter()

Method Detail

abbreviateback to summary
public AbbreviatedObjectId abbreviate(AnyObjectId objectId) throws IOException

Overrides org.eclipse.jgit.lib.ObjectReader.abbreviate.

Doc from org.eclipse.jgit.lib.ObjectReader.abbreviate.

Obtain a unique abbreviation (prefix) of an object SHA-1. This method uses a reasonable default for the minimum length. Callers who don't care about the minimum length should prefer this method. The returned abbreviation would expand back to the argument ObjectId when passed to resolve(AbbreviatedObjectId), assuming no new objects are added to this repository between calls.

Parameters
objectId:AnyObjectId

object identity that needs to be abbreviated.

Returns:AbbreviatedObjectId

SHA-1 abbreviation.

Annotations
@Override
Exceptions
IOException:
the object store cannot be read.
abbreviateback to summary
public AbbreviatedObjectId abbreviate(AnyObjectId objectId, int len) throws IOException

Overrides org.eclipse.jgit.lib.ObjectReader.abbreviate.

Doc from org.eclipse.jgit.lib.ObjectReader.abbreviate.

Obtain a unique abbreviation (prefix) of an object SHA-1. The returned abbreviation would expand back to the argument ObjectId when passed to resolve(AbbreviatedObjectId), assuming no new objects are added to this repository between calls. The default implementation of this method abbreviates the id to the minimum length, then resolves it to see if there are multiple results. When multiple results are found, the length is extended by 1 and resolve is tried again.

Parameters
objectId:AnyObjectId

object identity that needs to be abbreviated.

len:int

minimum length of the abbreviated string. Must be in the range [2, 40].

Returns:AbbreviatedObjectId

SHA-1 abbreviation. If no matching objects exist in the repository, the abbreviation will match the minimum length.

Annotations
@Override
Exceptions
IOException:
the object store cannot be read.
closeback to summary
public void close()

Implements abstract org.eclipse.jgit.lib.ObjectReader.close.

Implements java.lang.AutoCloseable.close.

Doc from org.eclipse.jgit.lib.ObjectReader.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Release any resources used by this reader.

A reader that has been released can be used again, but may need to be released after the subsequent usage.

Annotations
@Override
delegateback to summary
protected abstract ObjectReader delegate()

Get delegate ObjectReader to handle all processing

Returns:ObjectReader

delegate ObjectReader to handle all processing.

Since
4.4
getBitmapIndexback to summary
public BitmapIndex getBitmapIndex() throws IOException

Overrides org.eclipse.jgit.lib.ObjectReader.getBitmapIndex.

Doc from org.eclipse.jgit.lib.ObjectReader.getBitmapIndex.

An index that can be used to speed up ObjectWalks.

Returns:BitmapIndex

the index or null if one does not exist.

Annotations
@Override
Exceptions
IOException:
when the index fails to load
getCommitGraphback to summary
public Optional<CommitGraph> getCommitGraph() throws IOException

Overrides org.eclipse.jgit.lib.ObjectReader.getCommitGraph.

Doc from org.eclipse.jgit.lib.ObjectReader.getCommitGraph.

Get the commit-graph for this repository if available.

The commit graph can be created/modified/deleted while the repository is open and specific implementations decide when to refresh it.

Returns:Optional<CommitGraph>

the commit-graph or empty if the commit-graph does not exist or is invalid; always returns empty when core.commitGraph is false (default is false).

Annotations
@Override
Exceptions
IOException:
if it cannot open any of the underlying commit graph.
getCreatedFromInserterback to summary
public ObjectInserter getCreatedFromInserter()

Overrides org.eclipse.jgit.lib.ObjectReader.getCreatedFromInserter.

Doc from org.eclipse.jgit.lib.ObjectReader.getCreatedFromInserter.

Get the org.eclipse.jgit.lib.ObjectInserter from which this reader was created using inserter.newReader()

Returns:ObjectInserter

the org.eclipse.jgit.lib.ObjectInserter from which this reader was created using inserter.newReader(), or null if this reader was not created from an inserter.

Annotations
@Override
@Nullable
getObjectSizeback to summary
public long getObjectSize(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException

Overrides org.eclipse.jgit.lib.ObjectReader.getObjectSize.

Doc from org.eclipse.jgit.lib.ObjectReader.getObjectSize.

Get only the size of an object.

The default implementation of this method opens an ObjectLoader. Databases are encouraged to override this if a faster access method is available to them.

Parameters
objectId:AnyObjectId

identity of the object to open.

typeHint:int

hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.

Returns:long

size of object in bytes.

Annotations
@Override
Exceptions
MissingObjectException:
the object does not exist.
IncorrectObjectTypeException:
typeHint was not OBJ_ANY, and the object's actual type does not match typeHint.
IOException:
the object store cannot be accessed.
getObjectSizeback to summary
public <T extends ObjectId> AsyncObjectSizeQueue<T> getObjectSize(Iterable<T> objectIds, boolean reportMissing)

Overrides org.eclipse.jgit.lib.ObjectReader.getObjectSize.

Doc from org.eclipse.jgit.lib.ObjectReader.getObjectSize.

Asynchronous object size lookup.

Parameters
<T>
type of ObjectId
objectIds:Iterable<T>

objects to get the size of from the object store. The supplied collection must not be modified until the queue has finished.

reportMissing:boolean

if true missing objects are reported by calling failure with a MissingObjectException. This may be more expensive for the implementation to guarantee. If false the implementation may choose to report MissingObjectException, or silently skip over the object with no warning.

Returns:AsyncObjectSizeQueue<T>

queue to read object sizes from.

Annotations
@Override
getShallowCommitsback to summary
public Set<ObjectId> getShallowCommits() throws IOException

Implements abstract org.eclipse.jgit.lib.ObjectReader.getShallowCommits.

Doc from org.eclipse.jgit.lib.ObjectReader.getShallowCommits.

Returns IDs for those commits which should be considered as shallow.

Returns:Set<ObjectId>

IDs of shallow commits

Annotations
@Override
Exceptions
IOException:
if an error occurred
hasback to summary
public boolean has(AnyObjectId objectId) throws IOException

Overrides org.eclipse.jgit.lib.ObjectReader.has.

Doc from org.eclipse.jgit.lib.ObjectReader.has.

Does the requested object exist in this database?

Parameters
objectId:AnyObjectId

identity of the object to test for existence of.

Returns:boolean

true if the specified object is stored in this database.

Annotations
@Override
Exceptions
IOException:
the object store cannot be accessed.
hasback to summary
public boolean has(AnyObjectId objectId, int typeHint) throws IOException

Overrides org.eclipse.jgit.lib.ObjectReader.has.

Doc from org.eclipse.jgit.lib.ObjectReader.has.

Does the requested object exist in this database?

Parameters
objectId:AnyObjectId

identity of the object to test for existence of.

typeHint:int

hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.

Returns:boolean

true if the specified object is stored in this database.

Annotations
@Override
Exceptions
IOException:
the object store cannot be accessed.
newReaderback to summary
public ObjectReader newReader()

Implements abstract org.eclipse.jgit.lib.ObjectReader.newReader.

Doc from org.eclipse.jgit.lib.ObjectReader.newReader.

Construct a new reader from the same data.

Applications can use this method to build a new reader from the same data source, but for an different thread.

Returns:ObjectReader

a brand new reader, using the same data source.

Annotations
@Override
openback to summary
public ObjectLoader open(AnyObjectId objectId) throws MissingObjectException, IOException

Overrides org.eclipse.jgit.lib.ObjectReader.open.

Doc from org.eclipse.jgit.lib.ObjectReader.open.

Open an object from this database.

Parameters
objectId:AnyObjectId

identity of the object to open.

Returns:ObjectLoader

a org.eclipse.jgit.lib.ObjectLoader for accessing the object.

Annotations
@Override
Exceptions
MissingObjectException:
the object does not exist.
IOException:
the object store cannot be accessed.
openback to summary
public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException

Implements abstract org.eclipse.jgit.lib.ObjectReader.open.

Doc from org.eclipse.jgit.lib.ObjectReader.open.

Open an object from this database.

Parameters
objectId:AnyObjectId

identity of the object to open.

typeHint:int

hint about the type of object being requested, e.g. org.eclipse.jgit.lib.Constants#OBJ_BLOB; OBJ_ANY if the object type is not known, or does not matter to the caller.

Returns:ObjectLoader

a org.eclipse.jgit.lib.ObjectLoader for accessing the object.

Annotations
@Override
Exceptions
MissingObjectException:
the object does not exist.
IncorrectObjectTypeException:
typeHint was not OBJ_ANY, and the object's actual type does not match typeHint.
IOException:
the object store cannot be accessed.
openback to summary
public <T extends ObjectId> AsyncObjectLoaderQueue<T> open(Iterable<T> objectIds, boolean reportMissing)

Overrides org.eclipse.jgit.lib.ObjectReader.open.

Doc from org.eclipse.jgit.lib.ObjectReader.open.

Asynchronous object opening.

Parameters
<T>
type of ObjectId
objectIds:Iterable<T>

objects to open from the object store. The supplied collection must not be modified until the queue has finished.

reportMissing:boolean

if true missing objects are reported by calling failure with a MissingObjectException. This may be more expensive for the implementation to guarantee. If false the implementation may choose to report MissingObjectException, or silently skip over the object with no warning.

Returns:AsyncObjectLoaderQueue<T>

queue to read the objects from.

Annotations
@Override
resolveback to summary
public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException

Implements abstract org.eclipse.jgit.lib.ObjectReader.resolve.

Doc from org.eclipse.jgit.lib.ObjectReader.resolve.

Resolve an abbreviated ObjectId to its full form. This method searches for an ObjectId that begins with the abbreviation, and returns at least some matching candidates. If the returned collection is empty, no objects start with this abbreviation. The abbreviation doesn't belong to this repository, or the repository lacks the necessary objects to complete it. If the collection contains exactly one member, the abbreviation is (currently) unique within this database. There is a reasonably high probability that the returned id is what was previously abbreviated. If the collection contains 2 or more members, the abbreviation is not unique. In this case the implementation is only required to return at least 2 candidates to signal the abbreviation has conflicts. User friendly implementations should return as many candidates as reasonably possible, as the caller may be able to disambiguate further based on context. However since databases can be very large (e.g. 10 million objects) returning 625,000 candidates for the abbreviation "0" is simply unreasonable, so implementors should draw the line at around 256 matches.

Parameters
id:AbbreviatedObjectId

abbreviated id to resolve to a complete identity. The abbreviation must have a length of at least 2.

Returns:Collection<ObjectId>

candidates that begin with the abbreviated identity.

Annotations
@Override
Exceptions
IOException:
the object store cannot be read.
setAvoidUnreachableObjectsback to summary
public void setAvoidUnreachableObjects(boolean avoid)

Overrides org.eclipse.jgit.lib.ObjectReader.setAvoidUnreachableObjects.

Doc from org.eclipse.jgit.lib.ObjectReader.setAvoidUnreachableObjects.

Advise the reader to avoid unreachable objects.

While enabled the reader will skip over anything previously proven to be unreachable. This may be dangerous in the face of concurrent writes.

Parameters
avoid:boolean

true to avoid unreachable objects.

Annotations
@Override