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 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)