Top Description Fields Constructors Methods
org.eclipse.jgit.treewalk

public Class EmptyTreeIterator

extends AbstractTreeIterator
Class Inheritance
Imports
java.io.IOException, org.eclipse.jgit.errors.CorruptObjectException, .IncorrectObjectTypeException, org.eclipse.jgit.lib.ObjectId, .ObjectReader

Iterator over an empty tree (a directory with no files).

Field Summary

Inherited from org.eclipse.jgit.treewalk.AbstractTreeIterator:
attributesNodeDEFAULT_PATH_SIZEmatchesmatchShiftmodeparentpathpathLenpathOffsetzeroid

Constructor Summary

AccessConstructor and Description
public
EmptyTreeIterator()

Create a new iterator with no parent.

pack-priv
public
EmptyTreeIterator(final AbstractTreeIterator
parent tree iterator.
p
,
final byte[]
path array to be used by the child iterator. This path must contain the path from the top of the walk to the first child and must end with a '/'.
childPath
,
final int
position within childPath where the child can insert its data. The value at childPath[childPathOffset-1] must be '/'.
childPathOffset
)

Create an iterator for a subtree of an existing iterator.

Method Summary

Modifier and TypeMethod and Description
public void
back(int
number of entries to move the iterator by. Must be a positive, non-zero integer.
delta
)

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.back.

Move to prior entry, populating this iterator with the entry data.

public AbstractTreeIterator
createSubtreeIterator(ObjectReader
reader to load the tree data from.
reader
)

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.createSubtreeIterator.

Create a new iterator for the current entry's subtree.

public boolean
eof()

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.eof.

Is this tree iterator at its EOF point (no more entries)?

public boolean
first()

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.first.

Is this tree iterator positioned on its first entry?

public ObjectId
getEntryObjectId()

Overrides org.eclipse.jgit.treewalk.AbstractTreeIterator.getEntryObjectId.

Get the object id of the current entry.

public boolean
hasId()

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.hasId.

Whether the entry has a valid ObjectId.

public byte[]
idBuffer()

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.idBuffer.

Get the byte array buffer object IDs must be copied out of.

public int
idOffset()

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.idOffset.

Get the position within idBuffer() of this entry's ObjectId.

protected boolean
public void
next(int
number of entries to move the iterator by. Must be a positive, non-zero integer.
delta
)

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.next.

Move to next entry, populating this iterator with the entry data.

public void
reset()

Overrides org.eclipse.jgit.treewalk.AbstractTreeIterator.reset.

Position this iterator on the first entry.

public void
stopWalk()

Overrides org.eclipse.jgit.treewalk.AbstractTreeIterator.stopWalk.

Indicates to the iterator that no more entries will be read.

Inherited from org.eclipse.jgit.treewalk.AbstractTreeIterator:
createEmptyTreeIteratorcreateSubtreeIteratorensurePathCapacityfindFilefindFilegetEntryFileModegetEntryObjectIdgetEntryPathBuffergetEntryPathHashCodegetEntryPathLengthgetEntryPathStringgetEntryRawModegetNamegetNameLengthgetNameOffsetgrowPathidEqualisWorkTreepathComparepathComparepathCompareskiptoString

Constructor Detail

EmptyTreeIteratorback to summary
public EmptyTreeIterator()

Create a new iterator with no parent.

EmptyTreeIteratorback to summary
pack-priv EmptyTreeIterator(AbstractTreeIterator p)
EmptyTreeIteratorback to summary
public EmptyTreeIterator(final AbstractTreeIterator p, final byte[] childPath, final int childPathOffset)

Create an iterator for a subtree of an existing iterator.

The caller is responsible for setting up the path of the child iterator.

Parameters
p:AbstractTreeIterator

parent tree iterator.

childPath:byte[]

path array to be used by the child iterator. This path must contain the path from the top of the walk to the first child and must end with a '/'.

childPathOffset:int

position within childPath where the child can insert its data. The value at childPath[childPathOffset-1] must be '/'.

Method Detail

backback to summary
public void back(int delta) throws CorruptObjectException

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.back.

Doc from org.eclipse.jgit.treewalk.AbstractTreeIterator.back.

Move to prior entry, populating this iterator with the entry data.

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:

as well as any implementation dependent information necessary to accurately return data from idBuffer() and idOffset() when demanded.
Parameters
delta:int

number of entries to move the iterator by. Must be a positive, non-zero integer.

Annotations
@Override
Exceptions
CorruptObjectException:
the tree is invalid.
createSubtreeIteratorback to summary
public AbstractTreeIterator createSubtreeIterator(ObjectReader reader) throws IncorrectObjectTypeException, IOException

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.createSubtreeIterator.

Doc from org.eclipse.jgit.treewalk.AbstractTreeIterator.createSubtreeIterator.

Create a new iterator for the current entry's subtree.

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.

Parameters
reader:ObjectReader

reader to load the tree data from.

Returns:AbstractTreeIterator

a new parser that walks over the current subtree.

Annotations
@Override
Exceptions
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.
eofback to summary
public boolean eof()

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.eof.

Doc from org.eclipse.jgit.treewalk.AbstractTreeIterator.eof.

Is this tree iterator at its EOF point (no more entries)?

An iterator is at EOF if there is no current entry.

Returns:boolean

true if we have walked all entries and have none left.

Annotations
@Override
firstback to summary
public boolean first()

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.first.

Doc from org.eclipse.jgit.treewalk.AbstractTreeIterator.first.

Is this tree iterator positioned on its first entry?

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().

Returns:boolean

true if the iterator is positioned on the first entry.

Annotations
@Override
getEntryObjectIdback to summary
public ObjectId getEntryObjectId()

Overrides org.eclipse.jgit.treewalk.AbstractTreeIterator.getEntryObjectId.

Doc from org.eclipse.jgit.treewalk.AbstractTreeIterator.getEntryObjectId.

Get the object id of the current entry.

Returns:ObjectId

an object id for the current entry.

Annotations
@Override
hasIdback to summary
public boolean hasId()

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.hasId.

Doc from org.eclipse.jgit.treewalk.AbstractTreeIterator.hasId.

Whether the entry has a valid ObjectId.

Returns:boolean

true if the entry has a valid ObjectId.

Annotations
@Override
idBufferback to summary
public byte[] idBuffer()

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.idBuffer.

Doc from org.eclipse.jgit.treewalk.AbstractTreeIterator.idBuffer.

Get the byte array buffer object IDs must be copied out of.

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.

Returns:byte[]

byte array the implementation stores object IDs within.

Annotations
@Override
idOffsetback to summary
public int idOffset()

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.idOffset.

Doc from org.eclipse.jgit.treewalk.AbstractTreeIterator.idOffset.

Get the position within idBuffer() of this entry's ObjectId.

Returns:int

offset into the array returned by idBuffer() where the ObjectId must be copied out of.

Annotations
@Override
needsStopWalkback to summary
protected boolean needsStopWalk()

Overrides org.eclipse.jgit.treewalk.AbstractTreeIterator.needsStopWalk.

Doc from org.eclipse.jgit.treewalk.AbstractTreeIterator.needsStopWalk.

Whether the iterator implements stopWalk().

Returns:boolean

true if the iterator implements stopWalk().

Annotations
@Override
nextback to summary
public void next(int delta) throws CorruptObjectException

Implements abstract org.eclipse.jgit.treewalk.AbstractTreeIterator.next.

Doc from org.eclipse.jgit.treewalk.AbstractTreeIterator.next.

Move to next entry, populating this iterator with the entry data.

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:

as well as any implementation dependent information necessary to accurately return data from idBuffer() and idOffset() when demanded.
Parameters
delta:int

number of entries to move the iterator by. Must be a positive, non-zero integer.

Annotations
@Override
Exceptions
CorruptObjectException:
the tree is invalid.
resetback to summary
public void reset()

Overrides org.eclipse.jgit.treewalk.AbstractTreeIterator.reset.

Doc from org.eclipse.jgit.treewalk.AbstractTreeIterator.reset.

Position this iterator on the first entry. The default implementation of this method uses 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.

Annotations
@Override
stopWalkback to summary
public void stopWalk()

Overrides org.eclipse.jgit.treewalk.AbstractTreeIterator.stopWalk.

Doc from org.eclipse.jgit.treewalk.AbstractTreeIterator.stopWalk.

Indicates to the iterator that no more entries will be read.

This is only invoked by TreeWalk when the iteration is aborted early due to a org.eclipse.jgit.errors.StopWalkException being thrown from within a TreeFilter.

Annotations
@Override