org.apache.hadoop.examples
Class MultiFileWordCount.MultiFileLineRecordReader

java.lang.Object
  extended by org.apache.hadoop.examples.MultiFileWordCount.MultiFileLineRecordReader
All Implemented Interfaces:
RecordReader<MultiFileWordCount.WordOffset,Text>
Enclosing class:
MultiFileWordCount

public static class MultiFileWordCount.MultiFileLineRecordReader
extends Object
implements RecordReader<MultiFileWordCount.WordOffset,Text>

RecordReader is responsible from extracting records from the InputSplit. This record reader accepts a MultiFileSplit, which encapsulates several files, and no file is divided.


Constructor Summary
MultiFileWordCount.MultiFileLineRecordReader(Configuration conf, MultiFileSplit split)
           
 
Method Summary
 void close()
          Close this InputSplit to future operations.
 MultiFileWordCount.WordOffset createKey()
          Create an object of the appropriate type to be used as a key.
 Text 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(MultiFileWordCount.WordOffset key, Text 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

MultiFileWordCount.MultiFileLineRecordReader

public MultiFileWordCount.MultiFileLineRecordReader(Configuration conf,
                                                    MultiFileSplit split)
                                             throws IOException
Throws:
IOException
Method Detail

close

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

Specified by:
close in interface RecordReader<MultiFileWordCount.WordOffset,Text>
Throws:
IOException

getPos

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

Specified by:
getPos in interface RecordReader<MultiFileWordCount.WordOffset,Text>
Returns:
the current position in the input.
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<MultiFileWordCount.WordOffset,Text>
Returns:
progress from 0.0 to 1.0.
Throws:
IOException

next

public boolean next(MultiFileWordCount.WordOffset key,
                    Text 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<MultiFileWordCount.WordOffset,Text>
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 MultiFileWordCount.WordOffset 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<MultiFileWordCount.WordOffset,Text>
Returns:
a new key object.

createValue

public Text 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<MultiFileWordCount.WordOffset,Text>
Returns:
a new value object.


Copyright © 2009 The Apache Software Foundation