org.apache.hadoop.mapred

## Class SequenceFileAsBinaryOutputFormat

- java.lang.Object
- - org.apache.hadoop.mapred.FileOutputFormat<K,V>
  - - org.apache.hadoop.mapred.SequenceFileOutputFormat<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable>
    - - org.apache.hadoop.mapred.SequenceFileAsBinaryOutputFormat

- All Implemented Interfaces:
    OutputFormat<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable>

      @InterfaceAudience.Public
       @InterfaceStability.Stable
      public class SequenceFileAsBinaryOutputFormat
      extends SequenceFileOutputFormat<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable>

  An `OutputFormat` that writes keys, values to `SequenceFile`s in binary(raw) format

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `SequenceFileAsBinaryOutputFormat.WritableValueBytes` Inner class used for appendRaw

    - ### Nested classes/interfaces inherited from class org.apache.hadoop.mapred.FileOutputFormat

      `FileOutputFormat.Counter`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SequenceFileAsBinaryOutputFormat()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkOutputSpecs(org.apache.hadoop.fs.FileSystem ignored, JobConf job)` Check for validity of the output-specification for the job.
    `RecordWriter<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable>` | `getRecordWriter(org.apache.hadoop.fs.FileSystem ignored, JobConf job, String name, org.apache.hadoop.util.Progressable progress)` Get the `RecordWriter` for the given job.
    `static Class<? extends org.apache.hadoop.io.WritableComparable>` | `getSequenceFileOutputKeyClass(JobConf conf)` Get the key class for the `SequenceFile`
    `static Class<? extends org.apache.hadoop.io.Writable>` | `getSequenceFileOutputValueClass(JobConf conf)` Get the value class for the `SequenceFile`
    `static void` | `setSequenceFileOutputKeyClass(JobConf conf, Class<?> theClass)` Set the key class for the `SequenceFile`
    `static void` | `setSequenceFileOutputValueClass(JobConf conf, Class<?> theClass)` Set the value class for the `SequenceFile`

    - ### Methods inherited from class org.apache.hadoop.mapred.SequenceFileOutputFormat

      `getOutputCompressionType, getReaders, setOutputCompressionType`

    - ### Methods inherited from class org.apache.hadoop.mapred.FileOutputFormat

      `getCompressOutput, getOutputCompressorClass, getOutputPath, getPathForCustomFile, getTaskOutputPath, getUniqueName, getWorkOutputPath, setCompressOutput, setOutputCompressorClass, setOutputPath, setWorkOutputPath`

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

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

- - ### Constructor Detail

    - #### SequenceFileAsBinaryOutputFormat

          public SequenceFileAsBinaryOutputFormat()

  - ### Method Detail

    - #### setSequenceFileOutputKeyClass

          public static void setSequenceFileOutputKeyClass(JobConf conf,
                                                           Class<?> theClass)

      Set the key class for the `SequenceFile`

      This allows the user to specify the key class to be different from the actual class (`BytesWritable`) used for writing

      Parameters:
        `conf` - the `JobConf` to modify
        `theClass` - the SequenceFile output key class.

    - #### setSequenceFileOutputValueClass

          public static void setSequenceFileOutputValueClass(JobConf conf,
                                                             Class<?> theClass)

      Set the value class for the `SequenceFile`

      This allows the user to specify the value class to be different from the actual class (`BytesWritable`) used for writing

      Parameters:
        `conf` - the `JobConf` to modify
        `theClass` - the SequenceFile output key class.

    - #### getSequenceFileOutputKeyClass

          public static Class<? extends org.apache.hadoop.io.WritableComparable> getSequenceFileOutputKeyClass(JobConf conf)

      Get the key class for the `SequenceFile`
      Returns:
        the key class of the `SequenceFile`

    - #### getSequenceFileOutputValueClass

          public static Class<? extends org.apache.hadoop.io.Writable> getSequenceFileOutputValueClass(JobConf conf)

      Get the value class for the `SequenceFile`
      Returns:
        the value class of the `SequenceFile`

    - #### getRecordWriter

          public RecordWriter<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable> getRecordWriter(org.apache.hadoop.fs.FileSystem ignored,
                                                                                                                     JobConf job,
                                                                                                                     String name,
                                                                                                                     org.apache.hadoop.util.Progressable progress)
                                                                                                              throws IOException

      Description copied from interface: `OutputFormat`
      Get the `RecordWriter` for the given job.
      Specified by:
        `getRecordWriter` in interface `OutputFormat<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable>`
      Overrides:
        `getRecordWriter` in class `SequenceFileOutputFormat<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable>`
        `job` - configuration for the job whose output is being written.
        `name` - the unique name for this part of the output.
        `progress` - mechanism for reporting progress while writing to file.
      Returns:
        a `RecordWriter` to write the output for the job.
      Throws:
        `IOException`

    - #### checkOutputSpecs

          public void checkOutputSpecs(org.apache.hadoop.fs.FileSystem ignored,
                                       JobConf job)
                                throws IOException

      Description copied from interface: `OutputFormat`
      Check for validity of the output-specification for the job.

      This is to validate the output specification for the job when it is a job is submitted. Typically checks that it does not already exist, throwing an exception when it already exists, so that output is not overwritten.

      Specified by:
        `checkOutputSpecs` in interface `OutputFormat<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable>`
      Overrides:
        `checkOutputSpecs` in class `FileOutputFormat<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.BytesWritable>`
        `job` - job configuration.
      Throws:
        `IOException` - when output should not be attempted

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