org.apache.hadoop.mapred
Class SequenceFileRecordReader

java.lang.Object
  extended by org.apache.hadoop.mapred.SequenceFileRecordReader
All Implemented Interfaces:
RecordReader
Direct Known Subclasses:
SequenceFileAsTextRecordReader, StreamSequenceRecordReader

public class SequenceFileRecordReader
extends Object
implements RecordReader

An RecordReader for SequenceFiles.


Field Summary
protected  Configuration conf
           
 
Constructor Summary
SequenceFileRecordReader(Configuration conf, FileSplit split)
           
 
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.
protected  void getCurrentValue(Writable value)
           
 Class getKeyClass()
          The class of key that must be passed to next(Writable,Writable)..
 long getPos()
          Returns the current position in the input.
 float getProgress()
          Return the progress within the input split
 Class getValueClass()
          The class of value that must be passed to next(Writable,Writable)..
protected  boolean next(Writable key)
           
 boolean next(Writable key, Writable value)
          Reads the next key/value pair.
protected  void seek(long pos)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conf

protected Configuration conf
Constructor Detail

SequenceFileRecordReader

public SequenceFileRecordReader(Configuration conf,
                                FileSplit split)
                         throws IOException
Throws:
IOException
Method Detail

getKeyClass

public Class getKeyClass()
The class of key that must be passed to next(Writable,Writable)..


getValueClass

public Class getValueClass()
The class of value that must be passed to next(Writable,Writable)..


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
Description copied from interface: RecordReader
Reads the next key/value pair.

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)

next

protected boolean next(Writable key)
                throws IOException
Throws:
IOException

getCurrentValue

protected void getCurrentValue(Writable value)
                        throws IOException
Throws:
IOException

getProgress

public float getProgress()
                  throws IOException
Return the progress within the input split

Specified by:
getProgress in interface RecordReader
Returns:
0.0 to 1.0 of the input byte range
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
Throws:
IOException

seek

protected void seek(long pos)
             throws IOException
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