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

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

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class CombineFileRecordReaderWrapper<K,V>
extends Object
implements 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, Configuration conf, Reporter reporter, Integer idx)
           
 
Method Summary
 void close()
          Close this InputSplit to future operations.
 K createKey()
          Create an object of the appropriate type to be used as a key.
 V createValue()
          Create an object of the appropriate type to be used as a value.
 long getPos()
          Returns the current position in the input.
 float getProgress()
          How much of the input has the RecordReader consumed i.e.
 boolean next(K key, V value)
          Reads the next key/value pair from the input for processing.
 
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,
                                         Configuration conf,
                                         Reporter reporter,
                                         Integer idx)
                                  throws IOException
Throws:
IOException
Method Detail

next

public boolean next(K key,
                    V value)
             throws IOException
Description copied from interface: RecordReader
Reads the next key/value pair from the input for processing.

Specified by:
next in interface RecordReader<K,V>
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

createKey

public K createKey()
Description copied from interface: RecordReader
Create an object of the appropriate type to be used as a key.

Specified by:
createKey in interface RecordReader<K,V>
Returns:
a new key object.

createValue

public V createValue()
Description copied from interface: RecordReader
Create an object of the appropriate type to be used as a value.

Specified by:
createValue in interface RecordReader<K,V>
Returns:
a new value object.

getPos

public long getPos()
            throws IOException
Description copied from interface: RecordReader
Returns the current position in the input.

Specified by:
getPos in interface RecordReader<K,V>
Returns:
the current position in the input.
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: RecordReader
Close this InputSplit to future operations.

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

getProgress

public float getProgress()
                  throws IOException
Description copied from interface: RecordReader
How much of the input has the RecordReader consumed i.e. has been processed by?

Specified by:
getProgress in interface RecordReader<K,V>
Returns:
progress from 0.0 to 1.0.
Throws:
IOException


Copyright © 2013 Apache Software Foundation. All Rights Reserved.