org.apache.hadoop.mapred
Interface RecordReader

All Known Implementing Classes:
KeyValueLineRecordReader, LineRecordReader, SequenceFileAsTextRecordReader, SequenceFileRecordReader, StreamBaseRecordReader, StreamLineRecordReader, StreamSequenceRecordReader, StreamXmlRecordReader

public interface RecordReader

Reads key/value pairs from an input file FileSplit. Implemented by InputFormat implementations.


Method Summary
 void close()
          Close this to future operations.
 WritableComparable createKey()
          Create an object of the appropriate type to be used as a key.
 Writable createValue()
          Create an object of the appropriate type to be used as the value.
 long getPos()
          Returns the current position in the input.
 float getProgress()
          How far has the reader gone through the input.
 boolean next(Writable key, Writable value)
          Reads the next key/value pair.
 

Method Detail

next

boolean next(Writable key,
             Writable value)
             throws IOException
Reads the next key/value pair.

Parameters:
key - the key to read data into
value - the value to read data into
Returns:
true iff a key/value was read, false if at EOF
Throws:
IOException
See Also:
Writable.readFields(DataInput)

createKey

WritableComparable createKey()
Create an object of the appropriate type to be used as a key.

Returns:
a new key object

createValue

Writable createValue()
Create an object of the appropriate type to be used as the value.

Returns:
a new value object

getPos

long getPos()
            throws IOException
Returns the current position in the input.

Throws:
IOException

close

void close()
           throws IOException
Close this to future operations.

Throws:
IOException

getProgress

float getProgress()
                  throws IOException
How far has the reader gone through the input.

Returns:
progress from 0.0 to 1.0
Throws:
IOException


Copyright © 2006 The Apache Software Foundation