Class BuiltInZlibDeflater

java.lang.Object
java.util.zip.Deflater
org.apache.hadoop.io.compress.zlib.BuiltInZlibDeflater
All Implemented Interfaces:
Compressor

public class BuiltInZlibDeflater extends Deflater implements Compressor
A wrapper around java.util.zip.Deflater to make it conform to org.apache.hadoop.io.compress.Compressor interface.
  • Constructor Details

    • BuiltInZlibDeflater

      public BuiltInZlibDeflater(int level, boolean nowrap)
    • BuiltInZlibDeflater

      public BuiltInZlibDeflater(int level)
    • BuiltInZlibDeflater

      public BuiltInZlibDeflater()
  • Method Details

    • compress

      public int compress(byte[] b, int off, int len) throws IOException
      Description copied from interface: Compressor
      Fills specified buffer with compressed data. Returns actual number of bytes of compressed data. A return value of 0 indicates that needsInput() should be called in order to determine if more input data is required.
      Specified by:
      compress in interface Compressor
      Parameters:
      b - Buffer for the compressed data
      off - Start offset of the data
      len - Size of the buffer
      Returns:
      The actual number of bytes of compressed data.
      Throws:
      IOException - raised on errors performing I/O.
    • reinit

      public void reinit(Configuration conf)
      reinit the compressor with the given configuration. It will reset the compressor's compression level and compression strategy. Different from ZlibCompressor, BuiltInZlibDeflater only support three kind of compression strategy: FILTERED, HUFFMAN_ONLY and DEFAULT_STRATEGY. It will use DEFAULT_STRATEGY as default if the configured compression strategy is not supported.
      Specified by:
      reinit in interface Compressor
      Parameters:
      conf - Configuration from which new setting are fetched