public class HFileReaderImpl extends Object implements HFileReader
HFileReader.SEEK_TO_BEFORE_FIRST_KEY, SEEK_TO_EOF, SEEK_TO_FOUND, SEEK_TO_IN_RANGE| Constructor and Description |
|---|
HFileReaderImpl(SeekableDataInputStream stream,
long fileSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Option<KeyValue> |
getKeyValue() |
Option<ByteBuffer> |
getMetaBlock(String metaBlockName)
Gets the content of a meta block from HFile.
|
Option<byte[]> |
getMetaInfo(UTF8StringKey key)
Gets info entry from file info block of a HFile.
|
long |
getNumKeyValueEntries() |
void |
initializeMetadata()
Initializes metadata based on a HFile before other read operations.
|
boolean |
isSeeked() |
boolean |
next()
Scans to the next entry in the file.
|
boolean |
seekTo()
Positions this reader at the start of the file.
|
int |
seekTo(Key key)
seekTo or just before the passed
Key. |
public HFileReaderImpl(SeekableDataInputStream stream, long fileSize)
public void initializeMetadata()
throws IOException
HFileReaderinitializeMetadata in interface HFileReaderIOException - upon read errors.public Option<byte[]> getMetaInfo(UTF8StringKey key) throws IOException
HFileReadergetMetaInfo in interface HFileReaderkey - meta key.IOException - upon read errors.public Option<ByteBuffer> getMetaBlock(String metaBlockName) throws IOException
HFileReadergetMetaBlock in interface HFileReadermetaBlockName - meta block name.IOException - upon read errors.public long getNumKeyValueEntries()
getNumKeyValueEntries in interface HFileReaderpublic int seekTo(Key key) throws IOException
HFileReaderKey. Examine the return code to figure whether we
found the key or not. Consider the key-value pairs in the file,
kv[0] .. kv[n-1], where there are n KV pairs in the file.
The position only moves forward so the caller has to make sure the keys are sorted before making multiple calls of this method.
seekTo in interface HFileReaderkey - Key to seek to.false when it is called.IOException - upon read errors.public boolean seekTo()
throws IOException
HFileReaderseekTo in interface HFileReaderfalse if empty file; i.e. a call to next would return false and
the current key and value are undefined.IOException - upon read errors.public boolean next()
throws IOException
HFileReadernext in interface HFileReaderfalse if the current position is at the end;
otherwise true if more in file.IOException - upon read errors.public Option<KeyValue> getKeyValue() throws IOException
getKeyValue in interface HFileReaderKeyValue instance at current position.IOExceptionpublic boolean isSeeked()
isSeeked in interface HFileReadertrue if the reader has had one of the seek calls invoked; i.e.
HFileReader.seekTo() or HFileReader.seekTo(Key).
Otherwise, false.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2024 The Apache Software Foundation. All rights reserved.