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
Class RecordReader<KEYIN,VALUEIN>

    java.lang.Object
      org.apache.hadoop.mapreduce.RecordReader<KEYIN,VALUEIN>

Type Parameters:
  `KEYIN` -
  `VALUEIN` -

All Implemented Interfaces:
  Closeable

Direct Known Subclasses:
  LineRecordReader, SequenceFileRecordReader

    public abstract class RecordReader<KEYIN,VALUEIN>

extends Object
implements Closeable

The record reader breaks the data into key/value pairs for input to the `Mapper`.

Constructor Summary
`RecordReader()`

Method Summary
`abstract void` | `close()` Close the record reader.
`abstract KEYIN` | `getCurrentKey()` Get the current key
`abstract VALUEIN` | `getCurrentValue()` Get the current value.
`abstract float` | `getProgress()` The current progress of the record reader through its data.
`abstract void` | `initialize(InputSplit split, TaskAttemptContext context)` Called once at initialization.
`abstract boolean` | `nextKeyValue()` Read the next key, value pair.

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

Constructor Detail

### RecordReader

    public RecordReader()

Method Detail

### initialize

    public abstract void initialize(InputSplit split,
                                    TaskAttemptContext context)
                             throws IOException,
                                    InterruptedException

  Called once at initialization.

  Parameters:
    `split` - the split that defines the range of records to read
    `context` - the information about the task
  Throws:
    `IOException`
    `InterruptedException`

### nextKeyValue

    public abstract boolean nextKeyValue()
                                  throws IOException,
                                         InterruptedException

  Read the next key, value pair.

  Returns:
    true if a key/value pair was read
  Throws:
    `IOException`
    `InterruptedException`

### getCurrentKey

    public abstract KEYIN getCurrentKey()
                                 throws IOException,
                                        InterruptedException

  Get the current key

  Returns:
    the current key or null if there is no current key
  Throws:
    `IOException`
    `InterruptedException`

### getCurrentValue

    public abstract VALUEIN getCurrentValue()
                                     throws IOException,
                                            InterruptedException

  Get the current value.

  Returns:
    the object that was read
  Throws:
    `IOException`
    `InterruptedException`

### getProgress

    public abstract float getProgress()
                               throws IOException,
                                      InterruptedException

  The current progress of the record reader through its data.

  Returns:
    a number between 0.0 and 1.0 that is the fraction of the data read
  Throws:
    `IOException`
    `InterruptedException`

### close

    public abstract void close()
                        throws IOException

  Close the record reader.

  Specified by:
    `close` in interface `Closeable`
  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