public interface RecordReader extends java.io.Closeable, java.io.Serializable, Configurable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPEND_LABEL |
static java.lang.String |
LABELS |
static java.lang.String |
NAME_SPACE |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
getLabels()
List of label strings
|
java.util.List<RecordListener> |
getListeners()
Get the record listeners for this record reader.
|
boolean |
hasNext()
Whether there are anymore records
|
void |
initialize(Configuration conf,
InputSplit split)
Called once at initialization.
|
void |
initialize(InputSplit split)
Called once at initialization.
|
java.util.List<Record> |
loadFromMetaData(java.util.List<RecordMetaData> recordMetaDatas)
Load multiple records from the given a list of
RecordMetaData instances |
Record |
loadFromMetaData(RecordMetaData recordMetaData)
Load a single record from the given
RecordMetaData instanceNote: that for data that isn't splittable (i.e., text data that needs to be scanned/split), it is more efficient to load multiple records at once using loadFromMetaData(List) |
java.util.List<Writable> |
next()
Get the next record
|
Record |
nextRecord()
|
java.util.List<Writable> |
record(java.net.URI uri,
java.io.DataInputStream dataInputStream)
Load the record from the given DataInputStream
Unlike
next() the internal state of the RecordReader is not modified
Implementations of this method should not close the DataInputStream |
void |
reset()
Reset record reader iterator
|
void |
setListeners(java.util.Collection<RecordListener> listeners)
Set the record listeners for this record reader.
|
void |
setListeners(RecordListener... listeners)
Set the record listeners for this record reader.
|
getConf, setConf
static final java.lang.String NAME_SPACE
static final java.lang.String APPEND_LABEL
static final java.lang.String LABELS
void initialize(InputSplit split) throws java.io.IOException, java.lang.InterruptedException
split
- the split that defines the range of records to readjava.io.IOException
java.lang.InterruptedException
void initialize(Configuration conf, InputSplit split) throws java.io.IOException, java.lang.InterruptedException
conf
- a configuration for initializationsplit
- the split that defines the range of records to readjava.io.IOException
java.lang.InterruptedException
java.util.List<Writable> next()
boolean hasNext()
java.util.List<java.lang.String> getLabels()
void reset()
java.util.List<Writable> record(java.net.URI uri, java.io.DataInputStream dataInputStream) throws java.io.IOException
next()
the internal state of the RecordReader is not modified
Implementations of this method should not close the DataInputStreamjava.io.IOException
- if error occurs during reading from the input streamRecord nextRecord()
next()
, but returns a Record
object, that may include metadata such as the source
of the dataRecord loadFromMetaData(RecordMetaData recordMetaData) throws java.io.IOException
RecordMetaData
instanceloadFromMetaData(List)
recordMetaData
- Metadata for the record that we want to load fromjava.io.IOException
- If I/O error occurs during loadingjava.util.List<Record> loadFromMetaData(java.util.List<RecordMetaData> recordMetaDatas) throws java.io.IOException
RecordMetaData
instancesrecordMetaDatas
- Metadata for the records that we want to load fromjava.io.IOException
- If I/O error occurs during loadingjava.util.List<RecordListener> getListeners()
void setListeners(RecordListener... listeners)
void setListeners(java.util.Collection<RecordListener> listeners)