Java zlib

Why Jzlib

Java Platform API provides packages 'java.util.zip.*' for accessing to zlib, but that support is very limited if you need to use the essence of zlib. For example, we needed to full access to zlib to add the packet compression support to pure Java SSH system, but they are 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 any positive response has not been returned from JavaSoft, so this problem will not be solved forever. This is our motivation to hack JZlib.
Of course, this stuff must be useful for any other pure java programs, which need communications with compressed data stream. Feel free to use this stuff in your hack and we are very happy if we get some feedbacks.

For more details see JZlib -- zlib in pure Java

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License