public class CanonicalTreeParser extends AbstractTreeIterator
attributesNode, DEFAULT_PATH_SIZE, mode, parent, path, pathLen, pathOffset, zeroid| Constructor and Description |
|---|
CanonicalTreeParser()
Create a new parser.
|
CanonicalTreeParser(byte[] prefix,
ObjectReader reader,
AnyObjectId treeId)
Create a new parser for a tree appearing in a subset of a repository.
|
| Modifier and Type | Method and Description |
|---|---|
void |
back(int delta)
Move to prior entry, populating this iterator with the entry data.
|
CanonicalTreeParser |
createSubtreeIterator(ObjectReader reader)
Create a new iterator for the current entry's subtree.
|
CanonicalTreeParser |
createSubtreeIterator(ObjectReader reader,
MutableObjectId idBuffer)
Create a new iterator for the current entry's subtree.
|
CanonicalTreeParser |
createSubtreeIterator0(ObjectReader reader,
AnyObjectId id)
Back door to quickly create a subtree iterator for any subtree.
|
boolean |
eof()
Is this tree iterator at its EOF point (no more entries)?
|
boolean |
first()
Is this tree iterator positioned on its first entry?
|
AttributesNode |
getEntryAttributesNode(ObjectReader reader)
Retrieve the
AttributesNode for the
current entry. |
CanonicalTreeParser |
getParent()
Deprecated.
internal use only
|
boolean |
hasId()
Whether the entry has a valid ObjectId.
|
byte[] |
idBuffer()
Get the byte array buffer object IDs must be copied out of.
|
int |
idOffset()
Get the position within
AbstractTreeIterator.idBuffer() of this entry's ObjectId. |
CanonicalTreeParser |
next()
Get this iterator, or its parent, if the tree is at eof.
|
void |
next(int delta)
Move to next entry, populating this iterator with the entry data.
|
void |
reset()
Position this iterator on the first entry.
|
void |
reset(byte[] treeData)
Reset this parser to walk through the given tree data.
|
void |
reset(ObjectReader reader,
AnyObjectId id)
Reset this parser to walk through the given tree.
|
CanonicalTreeParser |
resetRoot(ObjectReader reader,
AnyObjectId id)
Reset this parser to walk through the given tree.
|
createEmptyTreeIterator, ensurePathCapacity, findFile, findFile, getEntryFileMode, getEntryObjectId, getEntryObjectId, getEntryPathBuffer, getEntryPathHashCode, getEntryPathLength, getEntryPathString, getEntryRawMode, getName, getNameLength, getNameOffset, growPath, idEqual, isWorkTree, needsStopWalk, pathCompare, pathCompare, skip, stopWalk, toStringpublic CanonicalTreeParser()
public CanonicalTreeParser(byte[] prefix,
ObjectReader reader,
AnyObjectId treeId)
throws IncorrectObjectTypeException,
IOException
prefix - position of this iterator in the repository tree. The value
may be null or the empty array to indicate the prefix is the
root of the repository. A trailing slash ('/') is
automatically appended if the prefix does not end in '/'.reader - reader to load the tree data from.treeId - identity of the tree being parsed; used only in exception
messages if data corruption is found.MissingObjectException - the object supplied is not available from the repository.IncorrectObjectTypeException - the object supplied as an argument is not actually a tree and
cannot be parsed as though it were a tree.IOException - a loose object or pack file could not be read.@Deprecated public CanonicalTreeParser getParent()
public void reset(byte[] treeData)
treeData - the raw tree content.public CanonicalTreeParser resetRoot(ObjectReader reader, AnyObjectId id) throws IncorrectObjectTypeException, IOException
reader - reader to use during repository access.id - identity of the tree being parsed; used only in exception
messages if data corruption is found.MissingObjectException - the object supplied is not available from the repository.IncorrectObjectTypeException - the object supplied as an argument is not actually a tree and
cannot be parsed as though it were a tree.IOException - a loose object or pack file could not be read.public CanonicalTreeParser next()
public void reset(ObjectReader reader, AnyObjectId id) throws IncorrectObjectTypeException, IOException
reader - reader to use during repository access.id - identity of the tree being parsed; used only in exception
messages if data corruption is found.MissingObjectException - the object supplied is not available from the repository.IncorrectObjectTypeException - the object supplied as an argument is not actually a tree and
cannot be parsed as though it were a tree.IOException - a loose object or pack file could not be read.public CanonicalTreeParser createSubtreeIterator(ObjectReader reader, MutableObjectId idBuffer) throws IncorrectObjectTypeException, IOException
The parent reference of the iterator must be this, otherwise
the caller would not be able to exit out of the subtree iterator
correctly and return to continue walking this.
createSubtreeIterator in class AbstractTreeIteratorreader - reader to load the tree data from.idBuffer - temporary ObjectId buffer for use by this method.IncorrectObjectTypeException - the current entry is not actually a tree and cannot be parsed
as though it were a tree.IOException - a loose object or pack file could not be read.public final CanonicalTreeParser createSubtreeIterator0(ObjectReader reader, AnyObjectId id) throws IOException
Don't use this unless you are ObjectWalk. The method is meant to be called only once the current entry has been identified as a tree and its identity has been converted into an ObjectId.
reader - reader to load the tree data from.id - ObjectId of the tree to open.IOException - a loose object or pack file could not be read.public CanonicalTreeParser createSubtreeIterator(ObjectReader reader) throws IncorrectObjectTypeException, IOException
The parent reference of the iterator must be this,
otherwise the caller would not be able to exit out of the subtree
iterator correctly and return to continue walking this.
createSubtreeIterator in class AbstractTreeIteratorreader - reader to load the tree data from.IncorrectObjectTypeException - the current entry is not actually a tree and cannot be parsed
as though it were a tree.IOException - a loose object or pack file could not be read.public boolean hasId()
hasId in class AbstractTreeIteratortrue if the entry has a valid ObjectId.public byte[] idBuffer()
The id buffer contains the bytes necessary to construct an ObjectId for the current entry of this iterator. The buffer can be the same buffer for all entries, or it can be a unique buffer per-entry. Implementations are encouraged to expose their private buffer whenever possible to reduce garbage generation and copying costs.
idBuffer in class AbstractTreeIteratorAbstractTreeIterator.getEntryObjectId()public int idOffset()
AbstractTreeIterator.idBuffer() of this entry's ObjectId.idOffset in class AbstractTreeIteratorAbstractTreeIterator.idBuffer() where the
ObjectId must be copied out of.public void reset()
back(1) until
first() is true. This is most likely not the most efficient
method of repositioning the iterator to its first entry, so subclasses
are strongly encouraged to override the method.reset in class AbstractTreeIteratorpublic boolean first()
An iterator is positioned on the first entry if back(1)
would be an invalid request as there is no entry before the current one.
An empty iterator (one with no entries) will be
first() && eof().
first in class AbstractTreeIteratorpublic boolean eof()
An iterator is at EOF if there is no current entry.
eof in class AbstractTreeIteratorpublic void next(int delta)
The delta indicates how many moves forward should occur. The most common delta is 1 to move to the next entry.
Implementations must populate the following members:
AbstractTreeIterator.modeAbstractTreeIterator.path (from AbstractTreeIterator.pathOffset to AbstractTreeIterator.pathLen)AbstractTreeIterator.pathLenAbstractTreeIterator.idBuffer() and AbstractTreeIterator.idOffset()
when demanded.next in class AbstractTreeIteratordelta - number of entries to move the iterator by. Must be a positive,
non-zero integer.public void back(int delta)
The delta indicates how many moves backward should occur.The most common delta is 1 to move to the prior entry.
Implementations must populate the following members:
AbstractTreeIterator.modeAbstractTreeIterator.path (from AbstractTreeIterator.pathOffset to AbstractTreeIterator.pathLen)AbstractTreeIterator.pathLenAbstractTreeIterator.idBuffer() and AbstractTreeIterator.idOffset()
when demanded.back in class AbstractTreeIteratordelta - number of entries to move the iterator by. Must be a positive,
non-zero integer.public AttributesNode getEntryAttributesNode(ObjectReader reader) throws IOException
AttributesNode for the
current entry.reader - ObjectReader used to parse the
.gitattributes entry.AttributesNode for the
current entry.IOExceptionCopyright © 2020 Eclipse JGit Project. All rights reserved.