org.apache.hadoop.hbase
Interface CellScanner

All Known Subinterfaces:
Codec.Decoder, SizedCellScanner
All Known Implementing Classes:
BaseDecoder, KeyValueCodec.KeyValueDecoder, KeyValueCodecWithTags.KeyValueDecoder

@InterfaceAudience.Private
@InterfaceStability.Unstable
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
 boolean advance()
          Advance the scanner 1 cell.
 Cell current()
           
 

Method Detail

current

Cell 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


Copyright © 2007-2015 The Apache Software Foundation. All Rights Reserved.