|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.avro.hadoop.file.SortedKeyValueFile.Reader<K,V>
K - The key type.V - The value type.public static class SortedKeyValueFile.Reader<K,V>
Reads a SortedKeyValueFile by loading the key index into memory.
When doing a lookup, this reader finds the correct block in the data file using the key index. It performs a single disk seek to the block and loads the entire block into memory. The block is scanned until the key is found or is determined not to exist.
| Nested Class Summary | |
|---|---|
static class |
SortedKeyValueFile.Reader.Options
A class to encapsulate the options of a Reader. |
| Constructor Summary | |
|---|---|
SortedKeyValueFile.Reader(SortedKeyValueFile.Reader.Options options)
Constructs a reader. |
|
| Method Summary | |
|---|---|
void |
close()
|
V |
get(K key)
Gets the first value associated with a given key, or null if it is not found. |
Iterator<AvroKeyValue<K,V>> |
iterator()
Returns an iterator starting at the current position in the file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SortedKeyValueFile.Reader(SortedKeyValueFile.Reader.Options options)
throws IOException
options - The options.
IOException - If there is an error.| Method Detail |
|---|
public V get(K key)
throws IOException
This method will move the current position in the file to the record immediately following the requested key.
key - The key to look up.
IOException - If there is an error.public Iterator<AvroKeyValue<K,V>> iterator()
Use the get() method to move the current position.
Note that this iterator is shared with other clients of the file; it does not contain a separate pointer into the file.
iterator in interface Iterable<AvroKeyValue<K,V>>
public void close()
throws IOException
close in interface CloseableIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||