@InterfaceAudience.Private public interface HFileScanner extends Shipper, Closeable
A scanner doesn't always have a key/value that it is pointing to when it is first created and
before seekTo()
/seekTo(Cell)
are called. In this case,
getKey()
/getValue()
returns null. At most other times, a key and value will be
available. The general pattern is that you position the Scanner using the seekTo variants and
then getKey and getValue.
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this HFile scanner and do necessary cleanup.
|
Cell |
getCell()
Returns Instance of
Cell . |
Cell |
getKey()
Gets the current key in the form of a cell.
|
String |
getKeyString()
Deprecated.
Since hbase-2.0.0
|
Cell |
getNextIndexedKey()
Returns the next key in the index (the key to seek to the next block)
|
HFile.Reader |
getReader()
Returns Reader that underlies this Scanner instance.
|
ByteBuffer |
getValue()
Gets a buffer view to the current value.
|
String |
getValueString()
Deprecated.
Since hbase-2.0.0
|
boolean |
isSeeked() |
boolean |
next()
Scans to the next entry in the file.
|
int |
reseekTo(Cell cell)
Reseek to or just before the passed
cell . |
boolean |
seekBefore(Cell cell)
Consider the cell stream of all the cells in the file,
c[0] .. |
boolean |
seekTo()
Positions this scanner at the start of the file.
|
int |
seekTo(Cell cell)
SeekTo or just before the passed
cell . |
int seekTo(Cell cell) throws IOException
cell
. Examine the return code to figure whether
we found the cell or not. Consider the cell stream of all the cells in the file,
c[0] .. c[n]
, where there are n cells in the file. n * @return -1, if cell <
c[0], no position; 0, such that c[i] = cell and scanner is left in position i; and 1, such that
c[i] < cell, and scanner is left in position i. The scanner will position itself between
c[i] and c[i+1] where c[i] < cell <= c[i+1]. If there is no cell c[i+1] greater than or
equal to the input cell, then the scanner will position itself at the end of the file and
next() will return false when it is called. nIOException
int reseekTo(Cell cell) throws IOException
cell
. Similar to seekTo except that this can
be called even if the scanner is not at the beginning of a file. This can be used to seek only
to cells which come after the current position of the scanner. Consider the cell stream of all
the cells in the file, c[0] .. c[n]
, where there are n cellc in the file after
current position of HFileScanner. The scanner will position itself between c[i] and c[i+1]
where c[i] < cell <= c[i+1]. If there is no cell c[i+1] greater than or equal to the
input cell, then the scanner will position itself at the end of the file and next() will return
false when it is called.cell
- Cell to find (should be non-null)IOException
boolean seekBefore(Cell cell) throws IOException
c[0] .. c[n]
, where there
are n cells in the file.cell
- Cell to findIOException
boolean seekTo() throws IOException
IOException
boolean next() throws IOException
IOException
Cell getKey()
seekTo(Cell)
before this
method.ByteBuffer getValue()
seekTo(Cell)
before this
method.@Deprecated String getKeyString()
seekTo(Cell)
before this method.@Deprecated String getValueString()
seekTo(Cell)
before this method.HFile.Reader getReader()
boolean isSeeked()
seekBefore(Cell)
or seekTo()
or seekTo(Cell)
. Otherwise returns false.Cell getNextIndexedKey()
void close()
close
in interface AutoCloseable
close
in interface Closeable
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.