Class CompressDeflate

java.lang.Object
org.h2.compress.CompressDeflate
All Implemented Interfaces:
Compressor

public class CompressDeflate extends Object implements Compressor
This is a wrapper class for the Deflater class. This algorithm supports the following options:
  • l or level: -1 (default), 0 (no compression), 1 (best speed), ..., 9 (best compression)
  • s or strategy: 0 (default), 1 (filtered), 2 (huffman only)
See also java.util.zip.Deflater for details.
  • Field Details

    • level

      private int level
    • strategy

      private int strategy
  • Constructor Details

    • CompressDeflate

      public CompressDeflate()
  • Method Details

    • setOptions

      public void setOptions(String options)
      Description copied from interface: Compressor
      Set the compression options. This may include settings for higher performance but less compression.
      Specified by:
      setOptions in interface Compressor
      Parameters:
      options - the options
    • compress

      public int compress(byte[] in, int inPos, int inLen, byte[] out, int outPos)
      Description copied from interface: Compressor
      Compress a number of bytes.
      Specified by:
      compress in interface Compressor
      Parameters:
      in - the input data
      inPos - the offset at the input array
      inLen - the number of bytes to compress
      out - the output area
      outPos - the offset at the output array
      Returns:
      the end position
    • getAlgorithm

      public int getAlgorithm()
      Description copied from interface: Compressor
      Get the compression algorithm type.
      Specified by:
      getAlgorithm in interface Compressor
      Returns:
      the type
    • expand

      public void expand(byte[] in, int inPos, int inLen, byte[] out, int outPos, int outLen)
      Description copied from interface: Compressor
      Expand a number of compressed bytes.
      Specified by:
      expand in interface Compressor
      Parameters:
      in - the compressed data
      inPos - the offset at the input array
      inLen - the number of bytes to read
      out - the output area
      outPos - the offset at the output array
      outLen - the size of the uncompressed data