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

Package org.apache.hadoop.io.compress

# Class GzipCodec

java.lang.Object
org.apache.hadoop.io.compress.DefaultCodec
org.apache.hadoop.io.compress.GzipCodec

All Implemented Interfaces:
  `Configurable`, `CompressionCodec`, `DirectDecompressionCodec`

@Public @Evolving public class GzipCodec extends DefaultCodec
This class creates gzip compressors/decompressors.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface org.apache.hadoop.io.compress.CompressionCodec

  `CompressionCodec.Util`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GzipCodec()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Compressor`
  `createCompressor()`
  Create a new `Compressor` for use by this `CompressionCodec`.
  `Decompressor`
  `createDecompressor()`
  Create a new `Decompressor` for use by this `CompressionCodec`.
  `DirectDecompressor`
  `createDirectDecompressor()`
  Create a new `DirectDecompressor` for use by this `DirectDecompressionCodec`.
  `CompressionInputStream`
  `createInputStream(InputStream in)`
  Create a `CompressionInputStream` that will read from the given input stream.
  `CompressionInputStream`
  `createInputStream(InputStream in, Decompressor decompressor)`
  Create a `CompressionInputStream` that will read from the given `InputStream` with the given `Decompressor`.
  `CompressionOutputStream`
  `createOutputStream(OutputStream out)`
  Create a `CompressionOutputStream` that will write to the given `OutputStream`.
  `CompressionOutputStream`
  `createOutputStream(OutputStream out, Compressor compressor)`
  Create a `CompressionOutputStream` that will write to the given `OutputStream` with the given `Compressor`.
  `Class<? extends Compressor>`
  `getCompressorType()`
  Get the type of `Compressor` needed by this `CompressionCodec`.
  `Class<? extends Decompressor>`
  `getDecompressorType()`
  Get the type of `Decompressor` needed by this `CompressionCodec`.
  `String`
  `getDefaultExtension()`
  Get the default filename extension for this kind of compression.

  ### Methods inherited from class org.apache.hadoop.io.compress.DefaultCodec

  `getConf, setConf`

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

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

- ## Constructor Details

  - ### GzipCodec

    public GzipCodec()

- ## Method Details

  - ### createOutputStream

    public CompressionOutputStream createOutputStream(OutputStream out) throws IOException
    Description copied from interface: `CompressionCodec`
    Create a `CompressionOutputStream` that will write to the given `OutputStream`.
    Specified by:
      `createOutputStream` in interface `CompressionCodec`
    Overrides:
      `createOutputStream` in class `DefaultCodec`
    Parameters:
      `out` - the location for the final output stream
    Returns:
      a stream the user can write uncompressed data to have it compressed
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### createOutputStream

    public CompressionOutputStream createOutputStream(OutputStream out, Compressor compressor) throws IOException
    Description copied from interface: `CompressionCodec`
    Create a `CompressionOutputStream` that will write to the given `OutputStream` with the given `Compressor`.
    Specified by:
      `createOutputStream` in interface `CompressionCodec`
    Overrides:
      `createOutputStream` in class `DefaultCodec`
    Parameters:
      `out` - the location for the final output stream
      `compressor` - compressor to use
    Returns:
      a stream the user can write uncompressed data to have it compressed
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### createCompressor

    public Compressor createCompressor()
    Description copied from interface: `CompressionCodec`
    Create a new `Compressor` for use by this `CompressionCodec`.
    Specified by:
      `createCompressor` in interface `CompressionCodec`
    Overrides:
      `createCompressor` in class `DefaultCodec`
    Returns:
      a new compressor for use by this codec

  - ### getCompressorType

    public Class<? extends Compressor> getCompressorType()
    Description copied from interface: `CompressionCodec`
    Get the type of `Compressor` needed by this `CompressionCodec`.
    Specified by:
      `getCompressorType` in interface `CompressionCodec`
    Overrides:
      `getCompressorType` in class `DefaultCodec`
    Returns:
      the type of compressor needed by this codec.

  - ### createInputStream

    public CompressionInputStream createInputStream(InputStream in) throws IOException
    Description copied from interface: `CompressionCodec`
    Create a `CompressionInputStream` that will read from the given input stream.
    Specified by:
      `createInputStream` in interface `CompressionCodec`
    Overrides:
      `createInputStream` in class `DefaultCodec`
    Parameters:
      `in` - the stream to read compressed bytes from
    Returns:
      a stream to read uncompressed bytes from
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### createInputStream

    public CompressionInputStream createInputStream(InputStream in, Decompressor decompressor) throws IOException
    Description copied from interface: `CompressionCodec`
    Create a `CompressionInputStream` that will read from the given `InputStream` with the given `Decompressor`.
    Specified by:
      `createInputStream` in interface `CompressionCodec`
    Overrides:
      `createInputStream` in class `DefaultCodec`
    Parameters:
      `in` - the stream to read compressed bytes from
      `decompressor` - decompressor to use
    Returns:
      a stream to read uncompressed bytes from
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### createDecompressor

    public Decompressor createDecompressor()
    Description copied from interface: `CompressionCodec`
    Create a new `Decompressor` for use by this `CompressionCodec`.
    Specified by:
      `createDecompressor` in interface `CompressionCodec`
    Overrides:
      `createDecompressor` in class `DefaultCodec`
    Returns:
      a new decompressor for use by this codec

  - ### getDecompressorType

    public Class<? extends Decompressor> getDecompressorType()
    Description copied from interface: `CompressionCodec`
    Get the type of `Decompressor` needed by this `CompressionCodec`.
    Specified by:
      `getDecompressorType` in interface `CompressionCodec`
    Overrides:
      `getDecompressorType` in class `DefaultCodec`
    Returns:
      the type of decompressor needed by this codec.

  - ### createDirectDecompressor

    public DirectDecompressor createDirectDecompressor()
    Description copied from class: `DefaultCodec`
    Create a new `DirectDecompressor` for use by this `DirectDecompressionCodec`.
    Specified by:
      `createDirectDecompressor` in interface `DirectDecompressionCodec`
    Overrides:
      `createDirectDecompressor` in class `DefaultCodec`
    Returns:
      a new direct decompressor for use by this codec

  - ### getDefaultExtension

    public String getDefaultExtension()
    Description copied from interface: `CompressionCodec`
    Get the default filename extension for this kind of compression.
    Specified by:
      `getDefaultExtension` in interface `CompressionCodec`
    Overrides:
      `getDefaultExtension` in class `DefaultCodec`
    Returns:
      the extension including the '.'