public static class TFile.Reader.Scanner extends Object implements Closeable
Use atEnd() to test whether the cursor is at the end
location of the scanner.
Use advance() to move the cursor to the next key-value
pair (or end if none exists). Use seekTo methods (
seekTo(byte[]) or
seekTo(byte[], int, int)) to seek to any arbitrary
location in the covered range (including backward seeking). Use
rewind() to seek back to the beginning of the scanner.
Use seekToEnd() to seek to the end of the scanner.
Actual keys and values may be obtained through TFile.Reader.Scanner.Entry
object, which is obtained through entry().
| Modifier and Type | Class and Description |
|---|---|
class |
TFile.Reader.Scanner.Entry
Entry to a <Key, Value> pair.
|
| Modifier | Constructor and Description |
|---|---|
protected |
TFile.Reader.Scanner(TFile.Reader reader,
long offBegin,
long offEnd)
Constructor
|
protected |
TFile.Reader.Scanner(TFile.Reader reader,
RawComparable beginKey,
RawComparable endKey)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
advance()
Move the cursor to the next key-value pair.
|
boolean |
atEnd()
Is cursor at the end location?
|
void |
close()
Close the scanner.
|
TFile.Reader.Scanner.Entry |
entry()
Get an entry to access the key and value.
|
long |
getRecordNum()
Get the RecordNum corresponding to the entry pointed by the cursor.
|
void |
lowerBound(byte[] key)
Move the cursor to the first entry whose key is greater than or equal
to the input key.
|
void |
lowerBound(byte[] key,
int keyOffset,
int keyLen)
Move the cursor to the first entry whose key is greater than or equal
to the input key.
|
void |
rewind()
Rewind to the first entry in the scanner.
|
boolean |
seekTo(byte[] key)
Move the cursor to the first entry whose key is greater than or equal
to the input key.
|
boolean |
seekTo(byte[] key,
int keyOffset,
int keyLen)
Move the cursor to the first entry whose key is greater than or equal
to the input key.
|
void |
seekToEnd()
Seek to the end of the scanner.
|
void |
upperBound(byte[] key)
Move the cursor to the first entry whose key is strictly greater than
the input key.
|
void |
upperBound(byte[] key,
int keyOffset,
int keyLen)
Move the cursor to the first entry whose key is strictly greater than
the input key.
|
protected TFile.Reader.Scanner(TFile.Reader reader, long offBegin, long offEnd) throws IOException
reader - The TFile reader object.offBegin - Begin byte-offset of the scan.offEnd - End byte-offset of the scan.IOException - The offsets will be rounded to the beginning of a compressed
block whose offset is greater than or equal to the specified
offset.protected TFile.Reader.Scanner(TFile.Reader reader, RawComparable beginKey, RawComparable endKey) throws IOException
reader - The TFile reader object.beginKey - Begin key of the scan. If null, scan from the first endKey - End key of the scan. If null, scan up to the last IOExceptionpublic boolean seekTo(byte[] key)
throws IOException
key - The input keyIOExceptionpublic boolean seekTo(byte[] key,
int keyOffset,
int keyLen)
throws IOException
key - The input keykeyOffset - offset in the key buffer.keyLen - key buffer length.IOExceptionpublic void rewind()
throws IOException
IOExceptionpublic void seekToEnd()
throws IOException
IOExceptionpublic void lowerBound(byte[] key)
throws IOException
key - The input keyIOExceptionpublic void lowerBound(byte[] key,
int keyOffset,
int keyLen)
throws IOException
key - The input keykeyOffset - offset in the key buffer.keyLen - key buffer length.IOExceptionpublic void upperBound(byte[] key)
throws IOException
key - The input keyIOExceptionpublic void upperBound(byte[] key,
int keyOffset,
int keyLen)
throws IOException
key - The input keykeyOffset - offset in the key buffer.keyLen - key buffer length.IOExceptionpublic boolean advance()
throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic boolean atEnd()
public TFile.Reader.Scanner.Entry entry() throws IOException
IOExceptionpublic long getRecordNum()
throws IOException
IOExceptionCopyright © 2019 Apache Software Foundation. All Rights Reserved.