Class DfsInserter.Reader
- java.lang.Object
-
- org.eclipse.jgit.lib.ObjectReader
-
- org.eclipse.jgit.internal.storage.dfs.DfsInserter.Reader
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Enclosing class:
- DfsInserter
private class DfsInserter.Reader extends ObjectReader
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jgit.lib.ObjectReader
ObjectReader.Filter
-
-
Field Summary
Fields Modifier and Type Field Description private DfsReaderctx-
Fields inherited from class org.eclipse.jgit.lib.ObjectReader
OBJ_ANY, streamFileThreshold
-
-
Constructor Summary
Constructors Modifier Constructor Description privateReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()ObjectInsertergetCreatedFromInserter()Get theObjectInserterfrom which this reader was created usinginserter.newReader()java.util.Set<ObjectId>getShallowCommits()Returns IDs for those commits which should be considered as shallow.booleanhas(AnyObjectId objectId)Does the requested object exist in this database?private byte[]inflate(PackedObjectInfo obj, long zpos, int sz)ObjectReadernewReader()Construct a new reader from the same data.ObjectLoaderopen(AnyObjectId objectId, int typeHint)Open an object from this database.java.util.Collection<ObjectId>resolve(AbbreviatedObjectId id)Resolve an abbreviated ObjectId to its full form.-
Methods inherited from class org.eclipse.jgit.lib.ObjectReader
abbreviate, abbreviate, createObjectReachabilityChecker, createReachabilityChecker, getBitmapIndex, getObjectSize, getObjectSize, getStreamFileThreshold, has, open, open, setAvoidUnreachableObjects, setStreamFileThreshold
-
-
-
-
Field Detail
-
ctx
private final DfsReader ctx
-
-
Method Detail
-
newReader
public ObjectReader newReader()
Description copied from class:ObjectReaderConstruct 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.
- Specified by:
newReaderin classObjectReader- Returns:
- a brand new reader, using the same data source.
-
resolve
public java.util.Collection<ObjectId> resolve(AbbreviatedObjectId id) throws java.io.IOException
Description copied from class:ObjectReaderResolve 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.- Specified by:
resolvein classObjectReader- Parameters:
id- abbreviated id to resolve to a complete identity. The abbreviation must have a length of at least 2.- Returns:
- candidates that begin with the abbreviated identity.
- Throws:
java.io.IOException- the object store cannot be read.
-
open
public ObjectLoader open(AnyObjectId objectId, int typeHint) throws java.io.IOException
Description copied from class:ObjectReaderOpen an object from this database.- Specified by:
openin classObjectReader- Parameters:
objectId- identity of the object to open.typeHint- hint about the type of object being requested, e.g.Constants.OBJ_BLOB;ObjectReader.OBJ_ANYif the object type is not known, or does not matter to the caller.- Returns:
- a
ObjectLoaderfor accessing the object. - Throws:
MissingObjectException- the object does not exist.IncorrectObjectTypeException- typeHint was not OBJ_ANY, and the object's actual type does not match typeHint.java.io.IOException- the object store cannot be accessed.
-
inflate
private byte[] inflate(PackedObjectInfo obj, long zpos, int sz) throws java.io.IOException, CorruptObjectException
- Throws:
java.io.IOExceptionCorruptObjectException
-
has
public boolean has(AnyObjectId objectId) throws java.io.IOException
Description copied from class:ObjectReaderDoes the requested object exist in this database?- Overrides:
hasin classObjectReader- Parameters:
objectId- identity of the object to test for existence of.- Returns:
- true if the specified object is stored in this database.
- Throws:
java.io.IOException- the object store cannot be accessed.
-
getShallowCommits
public java.util.Set<ObjectId> getShallowCommits() throws java.io.IOException
Description copied from class:ObjectReaderReturns IDs for those commits which should be considered as shallow.- Specified by:
getShallowCommitsin classObjectReader- Returns:
- IDs of shallow commits
- Throws:
java.io.IOException
-
getCreatedFromInserter
public ObjectInserter getCreatedFromInserter()
Description copied from class:ObjectReaderGet theObjectInserterfrom which this reader was created usinginserter.newReader()- Overrides:
getCreatedFromInserterin classObjectReader- Returns:
- the
ObjectInserterfrom which this reader was created usinginserter.newReader(), or null if this reader was not created from an inserter.
-
close
public void close()
Description copied from class:ObjectReaderRelease 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.
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein classObjectReader
-
-