Package org.rocksdb

Class RocksIterator

  • 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
    • 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 buffer key is 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 buffer value is insufficient and partial result will be returned.