CodecUtil (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.io.erasurecode, class: CodecUtil

Package org.apache.hadoop.io.erasurecode

# Class CodecUtil

java.lang.Object
org.apache.hadoop.io.erasurecode.CodecUtil

@Private public final class CodecUtil extends Object
A codec & coder utility to help create coders conveniently. `CodecUtil` includes erasure coder configurations key and default values such as coder class name and erasure codec option values included by `ErasureCodecOptions`. `ErasureEncoder` and `ErasureDecoder` are created by createEncoder and createDecoder respectively.`RawErasureEncoder` and `RawErasureDecoder` are are created by createRawEncoder and createRawDecoder.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `IO_ERASURECODE_CODEC`
  `static final String`
  `IO_ERASURECODE_CODEC_HHXOR`
  `static final String`
  `IO_ERASURECODE_CODEC_HHXOR_KEY`
  Erasure coder hitch hiker XOR codec.
  `static final boolean`
  `IO_ERASURECODE_CODEC_NATIVE_ENABLED_DEFAULT`
  `static final String`
  `IO_ERASURECODE_CODEC_NATIVE_ENABLED_KEY`
  `static final String`
  `IO_ERASURECODE_CODEC_RS`
  `static final String`
  `IO_ERASURECODE_CODEC_RS_KEY`
  Erasure coder Reed-Solomon codec.
  `static final String`
  `IO_ERASURECODE_CODEC_RS_LEGACY_RAWCODERS_KEY`
  Comma separated raw codec name.
  `static final String`
  `IO_ERASURECODE_CODEC_RS_RAWCODERS_KEY`
  `static final String`
  `IO_ERASURECODE_CODEC_XOR`
  `static final String`
  `IO_ERASURECODE_CODEC_XOR_KEY`
  Erasure coder XOR codec.
  `static final String`
  `IO_ERASURECODE_CODEC_XOR_RAWCODERS_KEY`
  Raw coder factory for the XOR codec.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static ErasureDecoder`
  `createDecoder(Configuration conf, ErasureCodecOptions options)`
  Create decoder corresponding to given codec.
  `static ErasureEncoder`
  `createEncoder(Configuration conf, ErasureCodecOptions options)`
  Create encoder corresponding to given codec.
  `static RawErasureDecoder`
  `createRawDecoder(Configuration conf, String codec, ErasureCoderOptions coderOptions)`
  Create RS raw decoder according to configuration.
  `static RawErasureEncoder`
  `createRawEncoder(Configuration conf, String codec, ErasureCoderOptions coderOptions)`
  Create RS raw encoder according to configuration.
  `static boolean`
  `hasCodec(String codecName)`

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

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

- ## Field Details

  - ### IO_ERASURECODE_CODEC

    public static final String IO_ERASURECODE_CODEC
    See Also:
      - Constant Field Values

  - ### IO_ERASURECODE_CODEC_XOR_KEY

    public static final String IO_ERASURECODE_CODEC_XOR_KEY
    Erasure coder XOR codec.
    See Also:
      - Constant Field Values

  - ### IO_ERASURECODE_CODEC_XOR

    public static final String IO_ERASURECODE_CODEC_XOR

  - ### IO_ERASURECODE_CODEC_RS_KEY

    public static final String IO_ERASURECODE_CODEC_RS_KEY
    Erasure coder Reed-Solomon codec.
    See Also:
      - Constant Field Values

  - ### IO_ERASURECODE_CODEC_RS

    public static final String IO_ERASURECODE_CODEC_RS

  - ### IO_ERASURECODE_CODEC_HHXOR_KEY

    public static final String IO_ERASURECODE_CODEC_HHXOR_KEY
    Erasure coder hitch hiker XOR codec.
    See Also:
      - Constant Field Values

  - ### IO_ERASURECODE_CODEC_HHXOR

    public static final String IO_ERASURECODE_CODEC_HHXOR

  - ### IO_ERASURECODE_CODEC_RS_LEGACY_RAWCODERS_KEY

    public static final String IO_ERASURECODE_CODEC_RS_LEGACY_RAWCODERS_KEY
    Comma separated raw codec name. The first coder is prior to the latter.
    See Also:
      - Constant Field Values

  - ### IO_ERASURECODE_CODEC_RS_RAWCODERS_KEY

    public static final String IO_ERASURECODE_CODEC_RS_RAWCODERS_KEY
    See Also:
      - Constant Field Values

  - ### IO_ERASURECODE_CODEC_XOR_RAWCODERS_KEY

    public static final String IO_ERASURECODE_CODEC_XOR_RAWCODERS_KEY
    Raw coder factory for the XOR codec.
    See Also:
      - Constant Field Values

  - ### IO_ERASURECODE_CODEC_NATIVE_ENABLED_KEY

    public static final String IO_ERASURECODE_CODEC_NATIVE_ENABLED_KEY
    See Also:
      - Constant Field Values

  - ### IO_ERASURECODE_CODEC_NATIVE_ENABLED_DEFAULT

    public static final boolean IO_ERASURECODE_CODEC_NATIVE_ENABLED_DEFAULT
    See Also:
      - Constant Field Values

- ## Method Details

  - ### createEncoder

    public static ErasureEncoder createEncoder(Configuration conf, ErasureCodecOptions options)
    Create encoder corresponding to given codec.
    Parameters:
      `options` - Erasure codec options
      `conf` - configuration.
    Returns:
      erasure encoder

  - ### createDecoder

    public static ErasureDecoder createDecoder(Configuration conf, ErasureCodecOptions options)
    Create decoder corresponding to given codec.
    Parameters:
      `options` - Erasure codec options
      `conf` - configuration.
    Returns:
      erasure decoder

  - ### createRawEncoder

    public static RawErasureEncoder createRawEncoder(Configuration conf, String codec, ErasureCoderOptions coderOptions)
    Create RS raw encoder according to configuration.
    Parameters:
      `conf` - configuration
      `coderOptions` - coder options that's used to create the coder
      `codec` - the codec to use. If null, will use the default codec
    Returns:
      raw encoder

  - ### createRawDecoder

    public static RawErasureDecoder createRawDecoder(Configuration conf, String codec, ErasureCoderOptions coderOptions)
    Create RS raw decoder according to configuration.
    Parameters:
      `conf` - configuration
      `coderOptions` - coder options that's used to create the coder
      `codec` - the codec to use. If null, will use the default codec
    Returns:
      raw decoder

  - ### hasCodec

    public static boolean hasCodec(String codecName)