Package com.jcraft.jsch.juz
Class Compression
java.lang.Object
com.jcraft.jsch.juz.Compression
- All Implemented Interfaces:
Compression
This example demonstrates the packet compression without using jzlib[1].
The ssh protocol adopts zlib[2] for the packet compression. Fortunately, JDK has provided wrapper
classes for zlib(j.u.z.{Deflater, Inflater}), but it does not expose enough functionality of
zlib, unfortunately; it must not allow to compress data with SYNC_FLUSH. So, JSch has been using
jzlib by the default. After 12 years of bug parade entry[3] filing, Java7 has revised
j.u.z.Deflater, and SYNC_FLUSH has been supported at last. This example shows how to enable the
packet compression by using JDK's java.util.zip package.
[1] http://www.jcraft.com/jzlib/ [2] http://www.zlib.net/ [3]
https://bugs.openjdk.java.net/browse/JDK-4206909
-
Field Summary
Fields inherited from interface com.jcraft.jsch.Compression
DEFLATER, INFLATER
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Compression
public Compression()
-
-
Method Details
-
end
public void end()- Specified by:
end
in interfaceCompression
-
init
- Specified by:
init
in interfaceCompression
-
init
public void init(int type, int level) - Specified by:
init
in interfaceCompression
-
compress
public byte[] compress(byte[] buf, int start, int[] end) - Specified by:
compress
in interfaceCompression
-
uncompress
public byte[] uncompress(byte[] buf, int start, int[] len) - Specified by:
uncompress
in interfaceCompression
-