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

Package org.apache.hadoop.io.compress

# Class CodecPool

java.lang.Object
org.apache.hadoop.io.compress.CodecPool

@Public @Evolving public class CodecPool extends Object
A global compressor/decompressor pool used to save and reuse (possibly native) compression/decompression codecs.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CodecPool()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Compressor`
  `getCompressor(CompressionCodec codec)`
  `static Compressor`
  `getCompressor(CompressionCodec codec, Configuration conf)`
  Get a `Compressor` for the given `CompressionCodec` from the pool or a new one.
  `static Decompressor`
  `getDecompressor(CompressionCodec codec)`
  Get a `Decompressor` for the given `CompressionCodec` from the pool or a new one.
  `static int`
  `getLeasedCompressorsCount(CompressionCodec codec)`
  Return the number of leased `Compressor`s for this `CompressionCodec`.
  `static int`
  `getLeasedDecompressorsCount(CompressionCodec codec)`
  Return the number of leased `Decompressor`s for this `CompressionCodec`.
  `static void`
  `returnCompressor(Compressor compressor)`
  Return the `Compressor` to the pool.
  `static void`
  `returnDecompressor(Decompressor decompressor)`
  Return the `Decompressor` to the pool.

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

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

- ## Constructor Details

  - ### CodecPool

    public CodecPool()

- ## Method Details

  - ### getCompressor

    public static Compressor getCompressor(CompressionCodec codec, Configuration conf)
    Get a `Compressor` for the given `CompressionCodec` from the pool or a new one.
    Parameters:
      `codec` - the `CompressionCodec` for which to get the `Compressor`
      `conf` - the `Configuration` object which contains confs for creating or reinit the compressor
    Returns:
      `Compressor` for the given `CompressionCodec` from the pool or a new one

  - ### getCompressor

    public static Compressor getCompressor(CompressionCodec codec)

  - ### getDecompressor

    public static Decompressor getDecompressor(CompressionCodec codec)
    Get a `Decompressor` for the given `CompressionCodec` from the pool or a new one.
    Parameters:
      `codec` - the `CompressionCodec` for which to get the `Decompressor`
    Returns:
      `Decompressor` for the given `CompressionCodec` the pool or a new one

  - ### returnCompressor

    public static void returnCompressor(Compressor compressor)
    Return the `Compressor` to the pool.
    Parameters:
      `compressor` - the `Compressor` to be returned to the pool

  - ### returnDecompressor

    public static void returnDecompressor(Decompressor decompressor)
    Return the `Decompressor` to the pool.
    Parameters:
      `decompressor` - the `Decompressor` to be returned to the pool

  - ### getLeasedCompressorsCount

    public static int getLeasedCompressorsCount(CompressionCodec codec)
    Return the number of leased `Compressor`s for this `CompressionCodec`.
    Parameters:
      `codec` - codec.
    Returns:
      the number of leased.

  - ### getLeasedDecompressorsCount

    public static int getLeasedDecompressorsCount(CompressionCodec codec)
    Return the number of leased `Decompressor`s for this `CompressionCodec`.
    Parameters:
      `codec` - codec.
    Returns:
      the number of leased