|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jgit.lib.ObjectReader
public abstract class ObjectReader
Reads an ObjectDatabase
for a single thread.
Readers that can support efficient reuse of pack encoded objects should also
implement the companion interface ObjectReuseAsIs
.
Field Summary | |
---|---|
static int |
OBJ_ANY
Type hint indicating the caller doesn't know the type. |
Constructor Summary | |
---|---|
ObjectReader()
|
Method Summary | ||
---|---|---|
AbbreviatedObjectId |
abbreviate(AnyObjectId objectId)
Obtain a unique abbreviation (prefix) of an object SHA-1. |
|
AbbreviatedObjectId |
abbreviate(AnyObjectId objectId,
int len)
Obtain a unique abbreviation (prefix) of an object SHA-1. |
|
long |
getObjectSize(AnyObjectId objectId,
int typeHint)
Get only the size of an object. |
|
|
getObjectSize(Iterable<T> objectIds,
boolean reportMissing)
Asynchronous object size lookup. |
|
boolean |
has(AnyObjectId objectId)
Does the requested object exist in this database? |
|
boolean |
has(AnyObjectId objectId,
int typeHint)
Does the requested object exist in this database? |
|
abstract ObjectReader |
newReader()
Construct a new reader from the same data. |
|
ObjectLoader |
open(AnyObjectId objectId)
Open an object from this database. |
|
abstract ObjectLoader |
open(AnyObjectId objectId,
int typeHint)
Open an object from this database. |
|
|
open(Iterable<T> objectIds,
boolean reportMissing)
Asynchronous object opening. |
|
void |
release()
Release any resources used by this reader. |
|
abstract Collection<ObjectId> |
resolve(AbbreviatedObjectId id)
Resolve an abbreviated ObjectId to its full form. |
|
void |
walkAdviceBeginCommits(RevWalk walk,
Collection<RevCommit> roots)
Advice from a RevWalk that a walk is starting from these roots. |
|
void |
walkAdviceBeginTrees(ObjectWalk ow,
RevCommit min,
RevCommit max)
Advice from an ObjectWalk that trees will be traversed. |
|
void |
walkAdviceEnd()
Advice from that a walk is over. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int OBJ_ANY
Constructor Detail |
---|
public ObjectReader()
Method Detail |
---|
public abstract ObjectReader newReader()
Applications can use this method to build a new reader from the same data source, but for an different thread.
public AbbreviatedObjectId abbreviate(AnyObjectId objectId) throws IOException
resolve(AbbreviatedObjectId)
, assuming no new objects
are added to this repository between calls.
objectId
- object identity that needs to be abbreviated.
IOException
- the object store cannot be read.public AbbreviatedObjectId abbreviate(AnyObjectId objectId, int len) throws IOException
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.
objectId
- object identity that needs to be abbreviated.len
- minimum length of the abbreviated string. Must be in the range
[2, ].
IOException
- the object store cannot be read.public abstract Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException
id
- abbreviated id to resolve to a complete identity. The
abbreviation must have a length of at least 2.
IOException
- the object store cannot be read.public boolean has(AnyObjectId objectId) throws IOException
objectId
- identity of the object to test for existence of.
IOException
- the object store cannot be accessed.public boolean has(AnyObjectId objectId, int typeHint) throws IOException
objectId
- identity of the object to test for existence of.typeHint
- hint about the type of object being requested;
OBJ_ANY
if the object type is not known, or does not
matter to the caller.
IncorrectObjectTypeException
- typeHint was not OBJ_ANY, and the object's actual type does
not match typeHint.
IOException
- the object store cannot be accessed.public ObjectLoader open(AnyObjectId objectId) throws MissingObjectException, IOException
objectId
- identity of the object to open.
ObjectLoader
for accessing the object.
MissingObjectException
- the object does not exist.
IOException
- the object store cannot be accessed.public abstract ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException
objectId
- identity of the object to open.typeHint
- hint about the type of object being requested;
OBJ_ANY
if the object type is not known, or does not
matter to the caller.
ObjectLoader
for accessing the object.
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.public <T extends ObjectId> AsyncObjectLoaderQueue<T> open(Iterable<T> objectIds, boolean reportMissing)
T
- type of identifier being supplied.objectIds
- objects to open from the object store. The supplied collection
must not be modified until the queue has finished.reportMissing
- 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.
public long getObjectSize(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException
The default implementation of this method opens an ObjectLoader. Databases are encouraged to override this if a faster access method is available to them.
objectId
- identity of the object to open.typeHint
- hint about the type of object being requested;
OBJ_ANY
if the object type is not known, or does not
matter to the caller.
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.public <T extends ObjectId> AsyncObjectSizeQueue<T> getObjectSize(Iterable<T> objectIds, boolean reportMissing)
T
- type of identifier being supplied.objectIds
- objects to get the size of from the object store. The supplied
collection must not be modified until the queue has finished.reportMissing
- 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.
public void walkAdviceBeginCommits(RevWalk walk, Collection<RevCommit> roots) throws IOException
RevWalk
that a walk is starting from these roots.
walk
- the revision pool that is using this reader.roots
- starting points of the revision walk. The starting points have
their headers parsed, but might be missing bodies.
IOException
- the reader cannot initialize itself to support the walk.public void walkAdviceBeginTrees(ObjectWalk ow, RevCommit min, RevCommit max) throws IOException
ObjectWalk
that trees will be traversed.
ow
- the object pool that is using this reader.min
- the first commit whose root tree will be read.max
- the last commit whose root tree will be read.
IOException
- the reader cannot initialize itself to support the walk.public void walkAdviceEnd()
public void release()
A reader that has been released can be used again, but may need to be released after the subsequent usage.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |