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

Package org.apache.hadoop.io.compress.zlib

# Class ZlibFactory

java.lang.Object
org.apache.hadoop.io.compress.zlib.ZlibFactory

public class ZlibFactory extends Object
A collection of factories to create the right zlib/gzip compressor/decompressor instances.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ZlibFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static ZlibCompressor.CompressionLevel`
  `getCompressionLevel(Configuration conf)`
  `static ZlibCompressor.CompressionStrategy`
  `getCompressionStrategy(Configuration conf)`
  `static String`
  `getLibraryName()`
  `static Compressor`
  `getZlibCompressor(Configuration conf)`
  Return the appropriate implementation of the zlib compressor.
  `static Class<? extends Compressor>`
  `getZlibCompressorType(Configuration conf)`
  Return the appropriate type of the zlib compressor.
  `static Decompressor`
  `getZlibDecompressor(Configuration conf)`
  Return the appropriate implementation of the zlib decompressor.
  `static Class<? extends Decompressor>`
  `getZlibDecompressorType(Configuration conf)`
  Return the appropriate type of the zlib decompressor.
  `static DirectDecompressor`
  `getZlibDirectDecompressor(Configuration conf)`
  Return the appropriate implementation of the zlib direct decompressor.
  `static boolean`
  `isNativeZlibLoaded(Configuration conf)`
  Check if native-zlib code is loaded & initialized correctly and can be loaded for this job.
  `static void`
  `loadNativeZLib()`
  Load native library and set the flag whether to use native library.
  `static void`
  `setCompressionLevel(Configuration conf, ZlibCompressor.CompressionLevel level)`
  `static void`
  `setCompressionStrategy(Configuration conf, ZlibCompressor.CompressionStrategy strategy)`
  `static void`
  `setNativeZlibLoaded(boolean isLoaded)`
  Set the flag whether to use native library.

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

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

- ## Constructor Details

  - ### ZlibFactory

    public ZlibFactory()

- ## Method Details

  - ### loadNativeZLib

    @VisibleForTesting public static void loadNativeZLib()
    Load native library and set the flag whether to use native library. The method is also used for reset the flag modified by setNativeZlibLoaded

  - ### setNativeZlibLoaded

    @VisibleForTesting public static void setNativeZlibLoaded(boolean isLoaded)
    Set the flag whether to use native library. Used for testing non-native libraries
    Parameters:
      `isLoaded` - isLoaded.

  - ### isNativeZlibLoaded

    public static boolean isNativeZlibLoaded(Configuration conf)
    Check if native-zlib code is loaded & initialized correctly and can be loaded for this job.
    Parameters:
      `conf` - configuration
    Returns:
      `true` if native-zlib is loaded & initialized and can be loaded for this job, else `false`

  - ### getLibraryName

    public static String getLibraryName()

  - ### getZlibCompressorType

    public static Class<? extends Compressor> getZlibCompressorType(Configuration conf)
    Return the appropriate type of the zlib compressor.
    Parameters:
      `conf` - configuration
    Returns:
      the appropriate type of the zlib compressor.

  - ### getZlibCompressor

    public static Compressor getZlibCompressor(Configuration conf)
    Return the appropriate implementation of the zlib compressor.
    Parameters:
      `conf` - configuration
    Returns:
      the appropriate implementation of the zlib compressor.

  - ### getZlibDecompressorType

    public static Class<? extends Decompressor> getZlibDecompressorType(Configuration conf)
    Return the appropriate type of the zlib decompressor.
    Parameters:
      `conf` - configuration
    Returns:
      the appropriate type of the zlib decompressor.

  - ### getZlibDecompressor

    public static Decompressor getZlibDecompressor(Configuration conf)
    Return the appropriate implementation of the zlib decompressor.
    Parameters:
      `conf` - configuration
    Returns:
      the appropriate implementation of the zlib decompressor.

  - ### getZlibDirectDecompressor

    public static DirectDecompressor getZlibDirectDecompressor(Configuration conf)
    Return the appropriate implementation of the zlib direct decompressor.
    Parameters:
      `conf` - configuration
    Returns:
      the appropriate implementation of the zlib decompressor.

  - ### setCompressionStrategy

    public static void setCompressionStrategy(Configuration conf, ZlibCompressor.CompressionStrategy strategy)

  - ### getCompressionStrategy

    public static ZlibCompressor.CompressionStrategy getCompressionStrategy(Configuration conf)

  - ### setCompressionLevel

    public static void setCompressionLevel(Configuration conf, ZlibCompressor.CompressionLevel level)

  - ### getCompressionLevel

    public static ZlibCompressor.CompressionLevel getCompressionLevel(Configuration conf)