org.apache.hadoop.mapreduce.lib.input
Class SequenceFileAsTextRecordReader

java.lang.Object
  extended by org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>
      extended by org.apache.hadoop.mapreduce.lib.input.SequenceFileAsTextRecordReader
All Implemented Interfaces:
java.io.Closeable

public class SequenceFileAsTextRecordReader
extends RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>

This class converts the input keys and values to their String forms by calling toString() method. This class to SequenceFileAsTextInputFormat class is as LineRecordReader class to TextInputFormat class.


Constructor Summary
SequenceFileAsTextRecordReader()
           
 
Method Summary
 void close()
          Close the record reader.
 org.apache.hadoop.io.Text getCurrentKey()
          Get the current key
 org.apache.hadoop.io.Text getCurrentValue()
          Get the current value.
 float getProgress()
          The current progress of the record reader through its data.
 void initialize(InputSplit split, TaskAttemptContext context)
          Called once at initialization.
 boolean nextKeyValue()
          Read key/value pair in a line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequenceFileAsTextRecordReader

public SequenceFileAsTextRecordReader()
                               throws java.io.IOException
Throws:
java.io.IOException
Method Detail

initialize

public void initialize(InputSplit split,
                       TaskAttemptContext context)
                throws java.io.IOException,
                       java.lang.InterruptedException
Description copied from class: RecordReader
Called once at initialization.

Specified by:
initialize in class RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>
Parameters:
split - the split that defines the range of records to read
context - the information about the task
Throws:
java.io.IOException
java.lang.InterruptedException

getCurrentKey

public org.apache.hadoop.io.Text getCurrentKey()
                                        throws java.io.IOException,
                                               java.lang.InterruptedException
Description copied from class: RecordReader
Get the current key

Specified by:
getCurrentKey in class RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>
Returns:
the current key or null if there is no current key
Throws:
java.io.IOException
java.lang.InterruptedException

getCurrentValue

public org.apache.hadoop.io.Text getCurrentValue()
                                          throws java.io.IOException,
                                                 java.lang.InterruptedException
Description copied from class: RecordReader
Get the current value.

Specified by:
getCurrentValue in class RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>
Returns:
the object that was read
Throws:
java.io.IOException
java.lang.InterruptedException

nextKeyValue

public boolean nextKeyValue()
                     throws java.io.IOException,
                            java.lang.InterruptedException
Read key/value pair in a line.

Specified by:
nextKeyValue in class RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>
Returns:
true if a key/value pair was read
Throws:
java.io.IOException
java.lang.InterruptedException

getProgress

public float getProgress()
                  throws java.io.IOException,
                         java.lang.InterruptedException
Description copied from class: RecordReader
The current progress of the record reader through its data.

Specified by:
getProgress in class RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>
Returns:
a number between 0.0 and 1.0 that is the fraction of the data read
Throws:
java.io.IOException
java.lang.InterruptedException

close

public void close()
           throws java.io.IOException
Description copied from class: RecordReader
Close the record reader.

Specified by:
close in interface java.io.Closeable
Specified by:
close in class RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>
Throws:
java.io.IOException


Copyright © 2009 The Apache Software Foundation