org.apache.hadoop.mapred
Class LineRecordReader

java.lang.Object
  extended by org.apache.hadoop.mapred.LineRecordReader
All Implemented Interfaces:
RecordReader
Direct Known Subclasses:
KeyValueLineRecordReader

public class LineRecordReader
extends Object
implements RecordReader

Treats keys as offset in file and value as line.

Author:
sanjaydahiya

Constructor Summary
LineRecordReader(Configuration job, FileSplit split)
           
LineRecordReader(InputStream in, long offset, long endOffset)
           
 
Method Summary
 void close()
          Close this to future operations.
 WritableComparable createKey()
          Create an object of the appropriate type to be used as a key.
 Writable createValue()
          Create an object of the appropriate type to be used as the value.
 long getPos()
          Returns the current position in the input.
 float getProgress()
          Get the progress within the split
 boolean next(Writable key, Writable value)
          Read a line.
protected  long readLine()
           
static long readLine(InputStream in, OutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineRecordReader

public LineRecordReader(Configuration job,
                        FileSplit split)
                 throws IOException
Throws:
IOException

LineRecordReader

public LineRecordReader(InputStream in,
                        long offset,
                        long endOffset)
                 throws IOException
Throws:
IOException
Method Detail

createKey

public WritableComparable 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
Returns:
a new key object

createValue

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

Specified by:
createValue in interface RecordReader
Returns:
a new value object

next

public boolean next(Writable key,
                    Writable value)
             throws IOException
Read a line.

Specified by:
next in interface RecordReader
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
See Also:
Writable.readFields(DataInput)

readLine

protected long readLine()
                 throws IOException
Throws:
IOException

readLine

public static long readLine(InputStream in,
                            OutputStream out)
                     throws IOException
Throws:
IOException

getProgress

public float getProgress()
Get the progress within the split

Specified by:
getProgress in interface RecordReader
Returns:
progress from 0.0 to 1.0

getPos

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

Specified by:
getPos in interface RecordReader
Throws:
IOException

close

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

Specified by:
close in interface RecordReader
Throws:
IOException


Copyright © 2006 The Apache Software Foundation