KeyValueLineRecordReader (Hadoop 1.2.1 API)
Date: 2013-07-22

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.mapreduce.lib.input
Class KeyValueLineRecordReader

    java.lang.Object
      org.apache.hadoop.mapreduce.RecordReader<Text,Text>
          org.apache.hadoop.mapreduce.lib.input.KeyValueLineRecordReader

All Implemented Interfaces:
  Closeable

    @InterfaceAudience.Public
    @InterfaceStability.Stable
    public class KeyValueLineRecordReader

extends RecordReader<Text,Text>

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 mapreduce.input.keyvaluelinerecordreader.key.value.separator. The default separator is the tab character ('\t').

Field Summary
`static String` | `KEY_VALUE_SEPERATOR`

Constructor Summary
`KeyValueLineRecordReader(Configuration conf)`

Method Summary
`void` | `close()` Close the record reader.
`static int` | `findSeparator(byte[] utf, int start, int length, byte sep)`
`Text` | `getCurrentKey()` Get the current key
`Text` | `getCurrentValue()` Get the current value.
`Class` | `getKeyClass()`
`float` | `getProgress()` The current progress of the record reader through its data.
`void` | `initialize(InputSplit genericSplit, TaskAttemptContext context)` Called once at initialization.
`boolean` | `nextKeyValue()` Read key/value pair in a line.
`static void` | `setKeyValue(Text key, Text value, byte[] line, int lineLen, int pos)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### KEY_VALUE_SEPERATOR

    public static final String KEY_VALUE_SEPERATOR

See Also:
  Constant Field Values

Constructor Detail

### KeyValueLineRecordReader

    public KeyValueLineRecordReader(Configuration conf)
                             throws IOException

Throws:
  `IOException`

Method Detail

### getKeyClass

    public Class getKeyClass()

### initialize

    public void initialize(InputSplit genericSplit,
                           TaskAttemptContext context)
                    throws IOException

  Description copied from class: `RecordReader`
  Called once at initialization.

  Specified by:
    `initialize` in class `RecordReader<Text,Text>`
  Parameters:
    `genericSplit` - the split that defines the range of records to read
    `context` - the information about the task
  Throws:
    `IOException`

### findSeparator

    public static int findSeparator(byte[] utf,
                                    int start,
                                    int length,
                                    byte sep)

### setKeyValue

    public static void setKeyValue(Text key,
                                   Text value,
                                   byte[] line,
                                   int lineLen,
                                   int pos)

### nextKeyValue

    public boolean nextKeyValue()
                         throws IOException

  Read key/value pair in a line.

  Specified by:
    `nextKeyValue` in class `RecordReader<Text,Text>`
  Returns:
    true if a key/value pair was read
  Throws:
    `IOException`

### getCurrentKey

    public Text getCurrentKey()

  Description copied from class: `RecordReader`
  Get the current key

  Specified by:
    `getCurrentKey` in class `RecordReader<Text,Text>`
  Returns:
    the current key or null if there is no current key

### getCurrentValue

    public Text getCurrentValue()

  Description copied from class: `RecordReader`
  Get the current value.

  Specified by:
    `getCurrentValue` in class `RecordReader<Text,Text>`
  Returns:
    the object that was read

### getProgress

    public float getProgress()
                      throws IOException

  Description copied from class: `RecordReader`
  The current progress of the record reader through its data.

  Specified by:
    `getProgress` in class `RecordReader<Text,Text>`
  Returns:
    a number between 0.0 and 1.0 that is the fraction of the data read
  Throws:
    `IOException`

### close

    public void close()
               throws IOException

  Description copied from class: `RecordReader`
  Close the record reader.

  Specified by:
    `close` in interface `Closeable`
  Specified by:
    `close` in class `RecordReader<Text,Text>`
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation