org.apache.hadoop.mapred

## Class SequenceFileAsTextRecordReader

- java.lang.Object
- - org.apache.hadoop.mapred.SequenceFileAsTextRecordReader

- All Implemented Interfaces:
    Closeable, AutoCloseable, RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>

      @InterfaceAudience.Public
       @InterfaceStability.Stable
      public class SequenceFileAsTextRecordReader
      extends Object
      implements RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>

  This class converts the input keys and values to their String forms by calling toString() method. This class to SequenceFileAsTextInputFormat class is as LineRecordReader class to TextInputFormat class.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SequenceFileAsTextRecordReader(org.apache.hadoop.conf.Configuration conf, FileSplit split)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close this `InputSplit` to future operations.
    `org.apache.hadoop.io.Text` | `createKey()` Create an object of the appropriate type to be used as a key.
    `org.apache.hadoop.io.Text` | `createValue()` Create an object of the appropriate type to be used as a value.
    `long` | `getPos()` Returns the current position in the input.
    `float` | `getProgress()` How much of the input has the `RecordReader` consumed i.e.
    `boolean` | `next(org.apache.hadoop.io.Text key, org.apache.hadoop.io.Text value)` Read key/value pair in a line.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SequenceFileAsTextRecordReader

          public SequenceFileAsTextRecordReader(org.apache.hadoop.conf.Configuration conf,
                                                FileSplit split)
                                         throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### createKey

          public org.apache.hadoop.io.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<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>`
      Returns:
        a new key object.

    - #### createValue

          public org.apache.hadoop.io.Text createValue()

      Description copied from interface: `RecordReader`
      Create an object of the appropriate type to be used as a value.
      Specified by:
        `createValue` in interface `RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>`
      Returns:
        a new value object.

    - #### next

          public boolean next(org.apache.hadoop.io.Text key,
                              org.apache.hadoop.io.Text value)
                       throws IOException

      Read key/value pair in a line.
      Specified by:
        `next` in interface `RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>`
      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`

    - #### getProgress

          public float getProgress()
                            throws IOException

      Description copied from interface: `RecordReader`
      How much of the input has the `RecordReader` consumed i.e. has been processed by?
      Specified by:
        `getProgress` in interface `RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>`
      Returns:
        progress from `0.0` to `1.0`.
      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<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>`
      Returns:
        the current position in the input.
      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Description copied from interface: `RecordReader`
      Close this `InputSplit` to future operations.
      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `RecordReader<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>`
      Throws:
        `IOException`

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.