org.apache.hadoop.mapred

## Class SequenceFileAsBinaryInputFormat.SequenceFileAsBinaryRecordReader

- java.lang.Object
- - org.apache.hadoop.mapred.SequenceFileAsBinaryInputFormat.SequenceFileAsBinaryRecordReader

- All Implemented Interfaces:
    Closeable, AutoCloseable, RecordReader<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable>
  Enclosing class:
    SequenceFileAsBinaryInputFormat

      public static class SequenceFileAsBinaryInputFormat.SequenceFileAsBinaryRecordReader
      extends Object
      implements RecordReader<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable>

  Read records from a SequenceFile as binary (raw) bytes.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SequenceFileAsBinaryRecordReader(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.BytesWritable` | `createKey()` Create an object of the appropriate type to be used as a key.
    `org.apache.hadoop.io.BytesWritable` | `createValue()` Create an object of the appropriate type to be used as a value.
    `String` | `getKeyClassName()` Retrieve the name of the key class for this SequenceFile.
    `long` | `getPos()` Returns the current position in the input.
    `float` | `getProgress()` Return the progress within the input split
    `String` | `getValueClassName()` Retrieve the name of the value class for this SequenceFile.
    `boolean` | `next(org.apache.hadoop.io.BytesWritable key, org.apache.hadoop.io.BytesWritable val)` Read raw bytes from a SequenceFile.

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

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

- - ### Constructor Detail

    - #### SequenceFileAsBinaryRecordReader

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

      Throws:
        `IOException`

  - ### Method Detail

    - #### createKey

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

    - #### createValue

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

    - #### getKeyClassName

          public String getKeyClassName()

      Retrieve the name of the key class for this SequenceFile.
      See Also:
        `SequenceFile.Reader.getKeyClassName()`

    - #### getValueClassName

          public String getValueClassName()

      Retrieve the name of the value class for this SequenceFile.
      See Also:
        `SequenceFile.Reader.getValueClassName()`

    - #### next

          public boolean next(org.apache.hadoop.io.BytesWritable key,
                              org.apache.hadoop.io.BytesWritable val)
                       throws IOException

      Read raw bytes from a SequenceFile.
      Specified by:
        `next` in interface `RecordReader<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable>`
      Parameters:
        `key` - the key to read data into
        `val` - the value to read data into
      Returns:
        true iff a key/value was read, false if at EOF
      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.BytesWritable,org.apache.hadoop.io.BytesWritable>`
      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.BytesWritable,org.apache.hadoop.io.BytesWritable>`
      Throws:
        `IOException`

    - #### getProgress

          public float getProgress()
                            throws IOException

      Return the progress within the input split
      Specified by:
        `getProgress` in interface `RecordReader<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable>`
      Returns:
        0.0 to 1.0 of the input byte range
      Throws:
        `IOException`

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