@InterfaceAudience.Private public interface HFileScanner
A scanner doesn't always have a key/value that it is pointing to
when it is first created and before
seekTo()
/seekTo(byte[])
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 the stream socket to handle RS CLOSE_WAIT.
|
ByteBuffer |
getKey()
Gets a buffer view to the current key.
|
String |
getKeyString()
Convenience method to get a copy of the key as a string - interpreting the
bytes as UTF8.
|
Cell |
getKeyValue() |
Cell |
getNextIndexedKey() |
HFile.Reader |
getReader() |
ByteBuffer |
getValue()
Gets a buffer view to the current value.
|
String |
getValueString()
Convenience method to get a copy of the value as a string - interpreting
the bytes as UTF8.
|
boolean |
isSeeked() |
boolean |
next()
Scans to the next entry in the file.
|
int |
reseekTo(byte[] key)
Deprecated.
|
int |
reseekTo(byte[] key,
int offset,
int length)
Deprecated.
|
int |
reseekTo(Cell c) |
boolean |
seekBefore(byte[] key)
Deprecated.
|
boolean |
seekBefore(byte[] key,
int offset,
int length)
Deprecated.
|
boolean |
seekBefore(Cell kv) |
boolean |
seekTo()
Positions this scanner at the start of the file.
|
int |
seekTo(byte[] key)
Deprecated.
|
int |
seekTo(byte[] key,
int offset,
int length)
Deprecated.
|
int |
seekTo(Cell c) |
@Deprecated int seekTo(byte[] key) throws IOException
key
. Examine the return
code to figure whether we found the key or not.
Consider the key stream of all the keys in the file,
k[0] .. k[n]
, where there are n keys in the file.key
- Key to find.IOException
@Deprecated int seekTo(byte[] key, int offset, int length) throws IOException
IOException
int seekTo(Cell c) throws IOException
IOException
@Deprecated int reseekTo(byte[] key) throws IOException
key
. 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 keys which come after the current position
of the scanner.
Consider the key stream of all the keys in the file,
k[0] .. k[n]
, where there are n keys in the file after
current position of HFileScanner.
The scanner will position itself between k[i] and k[i+1] where
k[i] < key <= k[i+1].
If there is no key k[i+1] greater than or equal to the input key, then the
scanner will position itself at the end of the file and next() will return
false when it is called.key
- Key to find (should be non-null)IOException
@Deprecated int reseekTo(byte[] key, int offset, int length) throws IOException
IOException
int reseekTo(Cell c) throws IOException
IOException
@Deprecated boolean seekBefore(byte[] key) throws IOException
k[0] .. k[n]
, where there are n keys in the file.key
- Key to findIOException
@Deprecated boolean seekBefore(byte[] key, int offset, int length) throws IOException
IOException
boolean seekBefore(Cell kv) throws IOException
IOException
boolean seekTo() throws IOException
IOException
boolean next() throws IOException
IOException
ByteBuffer getKey()
seekTo(byte[])
before this method.ByteBuffer getValue()
seekTo(byte[])
before this method.String getKeyString()
seekTo(byte[])
before this method.String getValueString()
seekTo(byte[])
before this method.HFile.Reader getReader()
boolean isSeeked()
seekBefore(byte[])
or seekTo()
or seekTo(byte[])
.
Otherwise returns false.Cell getNextIndexedKey()
void close()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.