org.apache.hadoop.mapreduce.lib.input
Class CombineFileRecordReaderWrapper<K,V>

java.lang.Object
  extended by org.apache.hadoop.mapreduce.RecordReader<K,V>
      extended by org.apache.hadoop.mapreduce.lib.input.CombineFileRecordReaderWrapper<K,V>
All Implemented Interfaces:
Closeable

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class CombineFileRecordReaderWrapper<K,V>
extends RecordReader<K,V>

A wrapper class for a record reader that handles a single file split. It delegates most of the methods to the wrapped instance. A concrete subclass needs to provide a constructor that calls this parent constructor with the appropriate input format. The subclass constructor must satisfy the specific constructor signature that is required by CombineFileRecordReader. Subclassing is needed to get a concrete record reader wrapper because of the constructor requirement.

See Also:
CombineFileRecordReader, CombineFileInputFormat

Constructor Summary
protected CombineFileRecordReaderWrapper(FileInputFormat<K,V> inputFormat, CombineFileSplit split, TaskAttemptContext context, Integer idx)
           
 
Method Summary
 void close()
          Close the record reader.
 K getCurrentKey()
          Get the current key
 V 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 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

CombineFileRecordReaderWrapper

protected CombineFileRecordReaderWrapper(FileInputFormat<K,V> inputFormat,
                                         CombineFileSplit split,
                                         TaskAttemptContext context,
                                         Integer idx)
                                  throws IOException,
                                         InterruptedException
Throws:
IOException
InterruptedException
Method Detail

initialize

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

Specified by:
initialize in class RecordReader<K,V>
Parameters:
split - the split that defines the range of records to read
context - the information about the task
Throws:
IOException
InterruptedException

nextKeyValue

public boolean nextKeyValue()
                     throws IOException,
                            InterruptedException
Description copied from class: RecordReader
Read the next key, value pair.

Specified by:
nextKeyValue in class RecordReader<K,V>
Returns:
true if a key/value pair was read
Throws:
IOException
InterruptedException

getCurrentKey

public K getCurrentKey()
                throws IOException,
                       InterruptedException
Description copied from class: RecordReader
Get the current key

Specified by:
getCurrentKey in class RecordReader<K,V>
Returns:
the current key or null if there is no current key
Throws:
IOException
InterruptedException

getCurrentValue

public V getCurrentValue()
                  throws IOException,
                         InterruptedException
Description copied from class: RecordReader
Get the current value.

Specified by:
getCurrentValue in class RecordReader<K,V>
Returns:
the object that was read
Throws:
IOException
InterruptedException

getProgress

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

Specified by:
getProgress in class RecordReader<K,V>
Returns:
a number between 0.0 and 1.0 that is the fraction of the data read
Throws:
IOException
InterruptedException

close

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

Specified by:
close in interface Closeable
Specified by:
close in class RecordReader<K,V>
Throws:
IOException


Copyright © 2014 Apache Software Foundation. All Rights Reserved.