Package org.apache.hadoop.io
Class SetFile.Reader
java.lang.Object
org.apache.hadoop.io.MapFile.Reader
org.apache.hadoop.io.SetFile.Reader
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- SetFile
Provide access to an existing set file.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.io.MapFile.Reader
MapFile.Reader.Option -
Constructor Summary
ConstructorsConstructorDescriptionReader(FileSystem fs, String dirName, Configuration conf) Construct a set reader for the named set.Reader(FileSystem fs, String dirName, WritableComparator comparator, Configuration conf) Construct a set reader for the named set using the named comparator. -
Method Summary
Modifier and TypeMethodDescriptionget(WritableComparable key) Read the matching key from a set intokey.booleannext(WritableComparable key) Read the next key in a set intokey.booleanseek(WritableComparable key) Positions the reader at the named key, or if none such exists, at the first entry after the named key.Methods inherited from class org.apache.hadoop.io.MapFile.Reader
close, comparator, createDataFileReader, finalKey, get, getClosest, getClosest, getKeyClass, getValueClass, midKey, next, open, reset
-
Constructor Details
-
Reader
Construct a set reader for the named set.- Parameters:
fs- input FileSystem.dirName- input dirName.conf- input Configuration.- Throws:
IOException- raised on errors performing I/O.
-
Reader
public Reader(FileSystem fs, String dirName, WritableComparator comparator, Configuration conf) throws IOException Construct a set reader for the named set using the named comparator.- Parameters:
fs- input FileSystem.dirName- input dirName.comparator- input comparator.conf- input Configuration.- Throws:
IOException- raised on errors performing I/O.
-
-
Method Details
-
seek
Description copied from class:MapFile.ReaderPositions the reader at the named key, or if none such exists, at the first entry after the named key. Returns true iff the named key exists in this map.- Overrides:
seekin classMapFile.Reader- Parameters:
key- key.- Returns:
- if the named key exists in this map true, not false.
- Throws:
IOException- raised on errors performing I/O.
-
next
Read the next key in a set intokey.- Parameters:
key- input key.- Returns:
- Returns true if such a key exists and false when at the end of the set.
- Throws:
IOException- raised on errors performing I/O.
-
get
Read the matching key from a set intokey.- Parameters:
key- input key.- Returns:
- Returns
key, or null if no match exists. - Throws:
IOException- raised on errors performing I/O.
-