java.io.Closeable, java.lang.AutoCloseableArrayFile.Reader, BloomMapFile.Reader, SetFile.Readerpublic static class MapFile.Reader
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
MapFile.Reader.Option |
| Constructor | Description |
|---|---|
Reader(FileSystem fs,
java.lang.String dirName,
Configuration conf) |
Deprecated.
|
Reader(FileSystem fs,
java.lang.String dirName,
WritableComparator comparator,
Configuration conf) |
Deprecated.
|
Reader(Path dir,
Configuration conf,
SequenceFile.Reader.Option... opts) |
| Modifier and Type | Method | 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.
|
java.lang.Class<?> |
getKeyClass() |
Returns the class of keys in this file.
|
java.lang.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 Reader(Path dir, Configuration conf, SequenceFile.Reader.Option... opts) throws java.io.IOException
java.io.IOException@Deprecated public Reader(FileSystem fs, java.lang.String dirName, Configuration conf) throws java.io.IOException
fs - FileSystem.dirName - dirName.conf - configuration.java.io.IOException - raised on errors performing I/O.@Deprecated public Reader(FileSystem fs, java.lang.String dirName, WritableComparator comparator, Configuration conf) throws java.io.IOException
fs - FileSystem.dirName - dirName.comparator - WritableComparator.conf - Configuration.java.io.IOException - raised on errors performing I/O.public java.lang.Class<?> getKeyClass()
public java.lang.Class<?> getValueClass()
public static MapFile.Reader.Option comparator(WritableComparator value)
protected void open(Path dir, WritableComparator comparator, Configuration conf, SequenceFile.Reader.Option... options) throws java.io.IOException
java.io.IOExceptionprotected SequenceFile.Reader createDataFileReader(Path dataFile, Configuration conf, SequenceFile.Reader.Option... options) throws java.io.IOException
SequenceFile.Reader returned.dataFile - data file.conf - configuration.options - options.java.io.IOException - raised on errors performing I/O.public void reset()
throws java.io.IOException
java.io.IOException - raised on errors performing I/O.public WritableComparable midKey() throws java.io.IOException
java.io.IOException - raised on errors performing I/O.public void finalKey(WritableComparable key) throws java.io.IOException
key - key to read intojava.io.IOException - raised on errors performing I/O.public boolean seek(WritableComparable key) throws java.io.IOException
key - key.java.io.IOException - raised on errors performing I/O.public boolean next(WritableComparable key, Writable val) throws java.io.IOException
key and
val. Returns true if such a pair exists and false when at
the end of the map.key - WritableComparable.val - Writable.java.io.IOException - raised on errors performing I/O.public Writable get(WritableComparable key, Writable val) throws java.io.IOException
key - key.val - val.java.io.IOException - raised on errors performing I/O.public WritableComparable getClosest(WritableComparable key, Writable val) throws java.io.IOException
key or if it does not exist, at the first entry
after the named key.key - key that we're trying to find.val - data value if key is found.java.io.IOException - raised on errors performing I/O.public WritableComparable getClosest(WritableComparable key, Writable val, boolean before) throws java.io.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.java.io.IOException - raised on errors performing I/O.public void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablejava.io.IOException - raised on errors performing I/O.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.