Class ZLibCompression

java.lang.Object
com.sshtools.common.zlib.ZLibCompression
All Implemented Interfaces:
Component, SshComponent, SshCompression
Direct Known Subclasses:
OpenSSHZLibCompression

public class ZLibCompression extends Object implements SshCompression
  • Constructor Details

    • ZLibCompression

      public ZLibCompression()
  • Method Details

    • getAlgorithm

      public String getAlgorithm()
      Description copied from interface: SshCompression
      Get the algorithm name for this compression implementation.
      Specified by:
      getAlgorithm in interface SshComponent
      Specified by:
      getAlgorithm in interface SshCompression
      Returns:
      the algorithm name.
    • init

      public void init(int type, int level)
      Description copied from interface: SshCompression
      Initialize the compression.
      Specified by:
      init in interface SshCompression
      Parameters:
      type - the mode of the compression, should be either INFLATER or DEFLATER
      level - the level of compression
    • compress

      public byte[] compress(byte[] buf, int start, int len) throws IOException
      Description copied from interface: SshCompression
      Compress a block of data.
      Specified by:
      compress in interface SshCompression
      Parameters:
      buf - the data to compress
      start - the offset of the data to compress
      len - the length of the data
      Returns:
      the compressed data with any uncompressed data at the start remaining intact.
      Throws:
      IOException
    • uncompress

      public byte[] uncompress(byte[] buffer, int start, int length) throws IOException
      Description copied from interface: SshCompression
      Uncompress a block of data.
      Specified by:
      uncompress in interface SshCompression
      Parameters:
      buffer - the data to uncompress
      start - the offset of the data to uncompress
      length - the length of the data
      Returns:
      the uncompressed data with any data not compressed at the start remaining intact.
      Throws:
      IOException