Interface CompressionService


public interface CompressionService
  • Method Details

    • toGzip

      InputStream toGzip(InputStream in) throws IOException
      Parameters:
      in - stream to compress, not null
      Returns:
      gzip compressed stream
      Throws:
      IOException
    • toBzip2

      InputStream toBzip2(InputStream in) throws IOException
      Uses blockSize 9.
      Parameters:
      in - stream to compress, not null
      Returns:
      bzip2 compressed stream
      Throws:
      IOException - if the stream content is malformed or an I/O error occurs
      See Also:
    • toBzip2

      InputStream toBzip2(InputStream in, int blockSize) throws IOException
      Parameters:
      in - stream to compress, not null
      blockSize - 1-9 (100k units)
      Returns:
      bzip2 compressed stream
      Throws:
      IOException - if the stream content is malformed or an I/O error occurs
    • toLzma2

      InputStream toLzma2(InputStream in) throws IOException
      Uses preset 6.
      Parameters:
      in - stream to compress, not null
      Returns:
      lzma2 compressed stream
      Throws:
      IOException
      See Also:
    • toLzma2

      InputStream toLzma2(InputStream in, int preset) throws IOException
      From XZ Java Library:

      The presets 0-3 are fast presets with medium compression. The presets 4-6 are fairly slow presets with high compression. The default preset is 6.

      The presets 7-9 are like the preset 6 but use bigger dictionaries and have higher compressor and decompressor memory requirements. Unless the uncompressed size of the file exceeds 8 MiB, 16 MiB, or 32 MiB, it is waste of memory to use the presets 7, 8, or 9, respectively.

      Parameters:
      in - stream to compress, not null
      preset - 0-9
      Returns:
      lzma2 compressed stream
      Throws:
      IOException
    • fromGzip

      InputStream fromGzip(InputStream in) throws IOException
      Parameters:
      in - gzip compressed stream, not null
      Returns:
      uncompressed stream
      Throws:
      IOException
    • fromBzip2

      InputStream fromBzip2(InputStream in) throws IOException
      Parameters:
      in - bzip2 compressed stream, not null
      Returns:
      uncompressed stream
      Throws:
      IOException
    • fromLzma2

      InputStream fromLzma2(InputStream in) throws IOException
      Parameters:
      in - lzma2 compressed stream, not null
      Returns:
      uncompressed stream
      Throws:
      IOException