Interface CellScanner

All Known Subinterfaces:
Codec.Decoder, ExtendedCellScanner, SizedExtendedCellScanner
All Known Implementing Classes:
BaseDecoder, CellCodec.CellDecoder, CellCodecWithTags.CellDecoder, KeyValueCodec.ByteBuffKeyValueDecoder, KeyValueCodec.KeyValueDecoder, KeyValueCodecWithTags.ByteBuffKeyValueDecoder, KeyValueCodecWithTags.KeyValueDecoder, MessageCodec.MessageDecoder, Result, SecureWALCellCodec.EncryptedKvDecoder, WALCellCodec.CompressedKvDecoder

@Public public interface CellScanner
An interface for iterating through a sequence of cells. Similar to Java's Iterator, but without the hasNext() or remove() methods. The hasNext() method is problematic because it may require actually loading the next object, which in turn requires storing the previous object somewhere.

The core data block decoder should be as fast as possible, so we push the complexity and performance expense of concurrently tracking multiple cells to layers above the CellScanner.

The current() method will return a reference to a Cell implementation. This reference may or may not point to a reusable cell implementation, so users of the CellScanner should not, for example, accumulate a List of Cells. All of the references may point to the same object, which would be the latest state of the underlying Cell. In short, the Cell is mutable.

Typical usage:
 while (scanner.advance()) {
   Cell cell = scanner.current();
   // do something
 }
 

Often used reading Cells written by CellOutputStream.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Advance the scanner 1 cell.
    Returns the current Cell which may be mutable
  • Method Details

    • current

      Returns the current Cell which may be mutable
    • advance

      boolean advance() throws IOException
      Advance the scanner 1 cell.
      Returns:
      true if the next cell is found and current() will return a valid Cell
      Throws:
      IOException - if advancing the scanner fails