org.apache.hadoop.mapred
Class KeyValueLineRecordReader
java.lang.Object
org.apache.hadoop.mapred.LineRecordReader
org.apache.hadoop.mapred.KeyValueLineRecordReader
- All Implemented Interfaces:
- RecordReader
- Direct Known Subclasses:
- StreamLineRecordReader
public class KeyValueLineRecordReader
- extends LineRecordReader
This class treats a line in the input as a key/value pair separated by a
separator character. The separator can be specified in config file
under the attribute name key.value.separator.in.input.line. The default
separator is the tab character ('\t').
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KeyValueLineRecordReader
public KeyValueLineRecordReader(Configuration job,
FileSplit split)
throws IOException
- Throws:
IOException
getKeyClass
public Class getKeyClass()
createKey
public Text 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
- Overrides:
createKey
in class LineRecordReader
- Returns:
- a new key object
findSeparator
public static int findSeparator(byte[] utf,
int start,
int length,
byte sep)
next
public boolean next(Writable key,
Writable value)
throws IOException
- Read key/value pair in a line.
- Specified by:
next
in interface RecordReader
- Overrides:
next
in class LineRecordReader
- Parameters:
key
- the key to read data intovalue
- 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)
Copyright © 2006 The Apache Software Foundation