Package org.iq80.leveldb.table
Class BlockIterator
java.lang.Object
org.iq80.leveldb.table.BlockIterator
- All Implemented Interfaces:
com.google.common.collect.PeekingIterator<Map.Entry<Slice,,Slice>> Iterator<Map.Entry<Slice,,Slice>> SeekingIterator<Slice,Slice>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Comparator<Slice> private final SliceInputprivate BlockEntryprivate final intprivate final Slice -
Constructor Summary
ConstructorsConstructorDescriptionBlockIterator(Slice data, Slice restartPositions, Comparator<Slice> comparator) -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()next()peek()private static BlockEntryreadEntry(SliceInput data, BlockEntry previousEntry) Reads the entry at the current data readIndex.voidremove()voidRepositions the iterator so the key of the next BlockElement returned greater than or equal to the specified targetKey.voidRepositions the iterator so the beginning of this block.private voidseekToRestartPosition(int restartPosition) Seeks to and reads the entry at the specified restart position.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
data
-
restartPositions
-
restartCount
private final int restartCount -
comparator
-
nextEntry
-
-
Constructor Details
-
BlockIterator
-
-
Method Details
-
hasNext
public boolean hasNext() -
peek
-
next
-
remove
public void remove() -
seekToFirst
public void seekToFirst()Repositions the iterator so the beginning of this block.- Specified by:
seekToFirstin interfaceSeekingIterator<Slice,Slice>
-
seek
Repositions the iterator so the key of the next BlockElement returned greater than or equal to the specified targetKey.- Specified by:
seekin interfaceSeekingIterator<Slice,Slice>
-
seekToRestartPosition
private void seekToRestartPosition(int restartPosition) Seeks to and reads the entry at the specified restart position. After this method, nextEntry will contain the next entry to return, and the previousEntry will be null. -
readEntry
Reads the entry at the current data readIndex. After this method, data readIndex is positioned at the beginning of the next entry or at the end of data if there was not a next entry.- Returns:
- true if an entry was read
-