public static class MapFile.Reader extends Object implements Closeable
Modifier and Type | Class and Description |
---|---|
static interface |
MapFile.Reader.Option |
Constructor and Description |
---|
MapFile.Reader(FileSystem fs,
String dirName,
Configuration conf)
Deprecated.
|
MapFile.Reader(FileSystem fs,
String dirName,
WritableComparator comparator,
Configuration conf)
Deprecated.
|
MapFile.Reader(Path dir,
Configuration conf,
SequenceFile.Reader.Option... opts) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the map.
|
static MapFile.Reader.Option |
comparator(WritableComparator value) |
protected SequenceFile.Reader |
createDataFileReader(Path dataFile,
Configuration conf,
SequenceFile.Reader.Option... options)
Override this method to specialize the type of
SequenceFile.Reader returned. |
void |
finalKey(WritableComparable key)
Reads the final key from the file.
|
Writable |
get(WritableComparable key,
Writable val)
Return the value for the named key, or null if none exists.
|
WritableComparable |
getClosest(WritableComparable key,
Writable val)
Finds the record that is the closest match to the specified key.
|
WritableComparable |
getClosest(WritableComparable key,
Writable val,
boolean before)
Finds the record that is the closest match to the specified key.
|
Class<?> |
getKeyClass()
Returns the class of keys in this file.
|
Class<?> |
getValueClass()
Returns the class of values in this file.
|
WritableComparable |
midKey()
Get the key at approximately the middle of the file.
|
boolean |
next(WritableComparable key,
Writable val)
Read the next key/value pair in the map into
key and
val . |
protected void |
open(Path dir,
WritableComparator comparator,
Configuration conf,
SequenceFile.Reader.Option... options) |
void |
reset()
Re-positions the reader before its first key.
|
boolean |
seek(WritableComparable key)
Positions the reader at the named key, or if none such exists, at the
first entry after the named key.
|
public MapFile.Reader(Path dir, Configuration conf, SequenceFile.Reader.Option... opts) throws IOException
IOException
@Deprecated public MapFile.Reader(FileSystem fs, String dirName, Configuration conf) throws IOException
IOException
@Deprecated public MapFile.Reader(FileSystem fs, String dirName, WritableComparator comparator, Configuration conf) throws IOException
IOException
public Class<?> getKeyClass()
public Class<?> getValueClass()
public static MapFile.Reader.Option comparator(WritableComparator value)
protected void open(Path dir, WritableComparator comparator, Configuration conf, SequenceFile.Reader.Option... options) throws IOException
IOException
protected SequenceFile.Reader createDataFileReader(Path dataFile, Configuration conf, SequenceFile.Reader.Option... options) throws IOException
SequenceFile.Reader
returned.IOException
public void reset() throws IOException
IOException
public WritableComparable midKey() throws IOException
IOException
public void finalKey(WritableComparable key) throws IOException
key
- key to read intoIOException
public boolean seek(WritableComparable key) throws IOException
IOException
public boolean next(WritableComparable key, Writable val) throws IOException
key
and
val
. Returns true if such a pair exists and false when at
the end of the mapIOException
public Writable get(WritableComparable key, Writable val) throws IOException
IOException
public WritableComparable getClosest(WritableComparable key, Writable val) throws IOException
key
or if it does not exist, at the first entry
after the named key.
- * @param key - key that we're trying to find
- * @param val - data value if key is found
- * @return - the key that was the closest match or null if eof.IOException
public WritableComparable getClosest(WritableComparable key, Writable val, boolean before) throws IOException
key
- - key that we're trying to findval
- - data value if key is foundbefore
- - IF true, and key
does not exist, return
the first entry that falls just before the key
. Otherwise,
return the record that sorts just after.IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2017 Apache Software Foundation. All Rights Reserved.