org.apache.accumulo.core.file.rfile.bcfile
public static class TFile.Reader extends Object implements Closeable
createScanner()
) ,
a portion of TFile based on byte offsets ( createScanner(long, long)
), or a portion of TFile with keys fall in a certain key range (for
sorted TFile only, createScanner(byte[], byte[])
or createScanner(RawComparable, RawComparable)
).Modifier and Type | Class and Description |
---|---|
static class |
TFile.Reader.Scanner
The TFile Scanner.
|
Constructor and Description |
---|
TFile.Reader(org.apache.hadoop.fs.FSDataInputStream fsdis,
long fileLength,
org.apache.hadoop.conf.Configuration conf)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the reader.
|
TFile.Reader.Scanner |
createScanner()
Get a scanner than can scan the whole TFile.
|
TFile.Reader.Scanner |
createScanner(byte[] beginKey,
byte[] endKey)
Get a scanner that covers a portion of TFile based on keys.
|
TFile.Reader.Scanner |
createScanner(long offset,
long length)
Get a scanner that covers a portion of TFile based on byte offsets.
|
TFile.Reader.Scanner |
createScanner(RawComparable beginKey,
RawComparable endKey)
Get a scanner that covers a specific key range.
|
Comparator<RawComparable> |
getComparator()
Get an instance of the RawComparator that is constructed based on the string comparator representation.
|
String |
getComparatorName()
Get the string representation of the comparator.
|
Comparator<TFile.Reader.Scanner.Entry> |
getEntryComparator()
Get a Comparator object to compare Entries.
|
long |
getEntryCount()
Get the number of key-value pair entries in TFile.
|
RawComparable |
getFirstKey()
Get the first key in the TFile.
|
RawComparable |
getKeyNear(long offset)
Get a sample key that is within a block whose starting offset is greater than or equal to the specified offset.
|
RawComparable |
getLastKey()
Get the last key in the TFile.
|
DataInputStream |
getMetaBlock(String name)
Stream access to a meta block.``
|
boolean |
isSorted()
Is the TFile sorted?
|
public TFile.Reader(org.apache.hadoop.fs.FSDataInputStream fsdis, long fileLength, org.apache.hadoop.conf.Configuration conf) throws IOException
fsdis
- FS input stream of the TFile.fileLength
- The length of TFile. This is required because we have no easy way of knowing the actual size of the input file through the File input stream.IOException
public void close() throws IOException
close
in interface Closeable
IOException
public String getComparatorName()
public boolean isSorted()
public long getEntryCount()
public RawComparable getFirstKey() throws IOException
IOException
public RawComparable getLastKey() throws IOException
IOException
public Comparator<TFile.Reader.Scanner.Entry> getEntryComparator()
public Comparator<RawComparable> getComparator()
public DataInputStream getMetaBlock(String name) throws IOException, MetaBlockDoesNotExist
name
- The name of the meta block.IOException
- on I/O error.MetaBlockDoesNotExist
- If the meta block with the name does not exist.public RawComparable getKeyNear(long offset) throws IOException
offset
- The file offset.IOException
public TFile.Reader.Scanner createScanner() throws IOException
IOException
public TFile.Reader.Scanner createScanner(long offset, long length) throws IOException
offset
- The beginning byte offset in the TFile.length
- The length of the region.IOException
public TFile.Reader.Scanner createScanner(byte[] beginKey, byte[] endKey) throws IOException
beginKey
- Begin key of the scan (inclusive). If null, scan from the first key-value entry of the TFile.endKey
- End key of the scan (exclusive). If null, scan up to the last key-value entry of the TFile.IOException
public TFile.Reader.Scanner createScanner(RawComparable beginKey, RawComparable endKey) throws IOException
beginKey
- Begin key of the scan (inclusive). If null, scan from the first key-value entry of the TFile.endKey
- End key of the scan (exclusive). If null, scan up to the last key-value entry of the TFile.IOException
Copyright © 2011-2015 The Apache Software Foundation. All Rights Reserved.