Package org.rocksdb

Class RocksIterator

All Implemented Interfaces:
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:
  • Constructor Details

    • RocksIterator

      protected RocksIterator(RocksDB rocksDB, long nativeHandle)
  • Method Details

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

      Parameters:
      key - the out-value to receive the retrieved key.
      Returns:
      The size of the actual key. If the return key is greater than the length of the buffer key, then it indicates that the size of the input buffer key is insufficient and partial result will be returned.
    • key

      public int key(byte[] key, int offset, int len)

      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.
      offset - in key at which to place the retrieved key
      len - limit to length of received key returned
      Returns:
      The size of the actual key. If the return key is greater than len, then it indicates that the size of the input buffer key is insufficient and partial result will be returned.
    • key

      public int key(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.
      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(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.
      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.
    • value

      public int value(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: AbstractRocksIterator.isValid()

      Parameters:
      value - the out-value to receive the retrieved value.
      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.
    • value

      public int value(byte[] value, int offset, int len)

      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.
      offset - the offset within value at which to place the result
      len - the length available in value after offset, for placing the result
      Returns:
      The size of the actual value. If the return value is greater than len, then it indicates that the size of the input buffer value is insufficient and partial result will be returned.
    • disposeInternal

      protected final void disposeInternal(long handle)
      Specified by:
      disposeInternal in class RocksObject