JZlib - zlib in pure Java

JZlib is a re-implementation of zlib in pure Java.
The first and final aim of developing JZlib was to add packet compression support to pure Java SSH systems.

Zlib

zlib is designed to be a free, general-purpose, legally unencumbered -- that is, not covered by any patents -- lossless data-compression library for use on virtually any computer hardware and operating system. zlib was written by Jean-loup Gailly (compression) and Mark Adler (decompression).

Features

Why JZlib?

Java Platform API provides packages 'java.util.zip.*' for accessing zlib, but that support is very limited if you need to use the essence of zlib. For example, we needed full access to zlib to add packet compression support to a pure Java SSH system, but it is useless for our requirements. The Internet draft SSH Transport Layer Protocol says in the section '4.2 Compression' as follows,

The following compression methods are currently defined:
  none  REQUIRED  no compression
  zlib  OPTIONAL  GNU ZLIB (LZ77) compression
The "zlib" compression is described in [RFC-1950] and in [RFC-1951]. The compression context is initialized after each key exchange, and is passed from one packet to the next with only a partial flush being performed at the end of each packet. A partial flush means that all data will be output, but the next packet will continue using compression tables from the end of the previous packet.

To implement this functionality, the Z_PARTIAL_FLUSH mode of zlib must be used, however JDK does not permit us to do so. It seems that this problem has been well known and some people have already reported to JavaSoft's BugParade(for example, BugId:4255743), but no positive response has been returned from JavaSoft, so this problem will never be solved. This is our motivation to develop JZlib.
Of course, JZlib should be useful for any other pure Java programs which need to communicate with compressed data streams. Feel free to use JZlib in your own projects, and we would be very happy to get some feedback.

Applications Using JZlib

References

We have referred to the following works in developing JZlib.

Download

JZlib 1.1.3 is provided in the zip format,

and also its latest source code is available at

Maven Repository

Presentations

Credits

JZlib has been developed by ymnk, but he has just re-implemented zlib in pure Java(it was just required to improve the service on WiredX.net). So, all credit should go to authors Jean-loup Gailly and Mark Adler and contributors of zlib.

Comments/suggestions are accepted at jzlib@jcraft.com.

``SSH is a registered trademark and Secure Shell is a trademark of SSH Communications Security Corp (www.ssh.com)''.