p2pMapReduce.mapreduceModule.input
Class RecordReader<KEYIN,VALUEIN>

java.lang.Object
  extended by p2pMapReduce.mapreduceModule.input.RecordReader<KEYIN,VALUEIN>
Type Parameters:
KEYIN -
VALUEIN -
All Implemented Interfaces:
java.io.Closeable
Direct Known Subclasses:
LineRecordReader

public abstract class RecordReader<KEYIN,VALUEIN>
extends java.lang.Object
implements java.io.Closeable

The record reader breaks the data into key/value pairs for input to the Mapper.


Constructor Summary
RecordReader()
           
 
Method Summary
abstract  void close()
          Close the record reader.
abstract  KEYIN getCurrentKey()
          Get the current key
abstract  VALUEIN getCurrentValue()
          Get the current value.
abstract  float getProgress()
          The current progress of the record reader through its data.
abstract  void initialize(InputSplit split, TaskAttemptContext context)
          Called once at initialization.
abstract  boolean nextKeyValue()
          Read the next key, value pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordReader

public RecordReader()
Method Detail

initialize

public abstract void initialize(InputSplit split,
                                TaskAttemptContext context)
                         throws java.io.IOException,
                                java.lang.InterruptedException
Called once at initialization.

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

nextKeyValue

public abstract boolean nextKeyValue()
                              throws java.io.IOException,
                                     java.lang.InterruptedException
Read the next key, value pair.

Returns:
true if a key/value pair was read
Throws:
java.io.IOException
java.lang.InterruptedException

getCurrentKey

public abstract KEYIN getCurrentKey()
                             throws java.io.IOException,
                                    java.lang.InterruptedException
Get the current key

Returns:
the current key or null if there is no current key
Throws:
java.io.IOException
java.lang.InterruptedException

getCurrentValue

public abstract VALUEIN getCurrentValue()
                                 throws java.io.IOException,
                                        java.lang.InterruptedException
Get the current value.

Returns:
the object that was read
Throws:
java.io.IOException
java.lang.InterruptedException

getProgress

public abstract float getProgress()
                           throws java.io.IOException,
                                  java.lang.InterruptedException
The current progress of the record reader through its data.

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 abstract void close()
                    throws java.io.IOException
Close the record reader.

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException