Class RocksIterator
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.AutoCloseable,RocksIteratorInterface
public class RocksIterator extends AbstractRocksIterator<RocksDB>
An iterator that yields a sequence of key/value pairs from a source. Multiple implementations are provided by this library. In particular, iterators are provided to access the contents of a Table or a DB.
Multiple threads can invoke const methods on an RocksIterator without external synchronization, but if any of the threads may call a non-const method, all threads accessing the same RocksIterator must use external synchronization.
- See Also:
RocksObject
-
-
Field Summary
-
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_
-
Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRocksIterator(RocksDB rocksDB, long nativeHandle)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddisposeInternal(long handle)byte[]key()Return the key for the current entry.intkey(java.nio.ByteBuffer key)Return the key for the current entry.byte[]value()Return the value for the current entry.intvalue(java.nio.ByteBuffer value)Return the value for the current entry.-
Methods inherited from class org.rocksdb.AbstractRocksIterator
disposeInternal, isValid, next, prev, refresh, seek, seek, seekForPrev, seekForPrev, seekToFirst, seekToLast, status
-
Methods inherited from class org.rocksdb.RocksObject
getNativeHandle
-
Methods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Methods inherited from class org.rocksdb.AbstractNativeReference
dispose, finalize
-
-
-
-
Constructor Detail
-
RocksIterator
protected RocksIterator(RocksDB rocksDB, long nativeHandle)
-
-
Method Detail
-
key
public byte[] key()
Return the key for the current entry. The underlying storage for the returned slice is valid only until the next modification of the iterator.
REQUIRES:
AbstractRocksIterator.isValid()- Returns:
- key for the current entry.
-
key
public int key(java.nio.ByteBuffer key)
Return the key for the current entry. The underlying storage for the returned slice is valid only until the next modification of the iterator.
REQUIRES:
AbstractRocksIterator.isValid()- Parameters:
key- the out-value to receive the retrieved key. It is using position and limit. Limit is set according to key size. Supports direct buffer only.- Returns:
- The size of the actual key. If the return key is greater than the
length of
key, then it indicates that the size of the input bufferkeyis insufficient and partial result will be returned.
-
value
public byte[] value()
Return the value for the current entry. The underlying storage for the returned slice is valid only until the next modification of the iterator.
REQUIRES: !AtEnd() && !AtStart()
- Returns:
- value for the current entry.
-
value
public int value(java.nio.ByteBuffer value)
Return the value for the current entry. The underlying storage for the returned slice is valid only until the next modification of the iterator.
REQUIRES:
AbstractRocksIterator.isValid()- Parameters:
value- the out-value to receive the retrieved value. It is using position and limit. Limit is set according to value size. Supports direct buffer only.- Returns:
- The size of the actual value. If the return value is greater than the
length of
value, then it indicates that the size of the input buffervalueis insufficient and partial result will be returned.
-
disposeInternal
protected final void disposeInternal(long handle)
- Specified by:
disposeInternalin classRocksObject
-
-