RFR JDK-8133170 : Deflater.deflate with small output buffers fails

Xueming Shen xueming.shen at oracle.com
Thu Jul 7 19:13:09 UTC 2016


Please help review the doc only change for this issue.

issue: https://bugs.openjdk.java.net/browse/JDK-8133170
webrev: http://cr.openjdk.java.net/~sherman/8133170/webrev

As explained in the zlib.h (quoted below), there are 5 bytes of flush marker
being output to the output buffer repeatedly every time this method is invoked,
a > 6 bytes buffer length is requested to make FULL_FLUSH and SYNC_FLUSH

The proposed change here is to add this ">6 bytes" request into the java doc
as suggested by the submitter.

    If flush is set to Z_FULL_FLUSH, all output is flushed as with
   Z_SYNC_FLUSH, and the compression state is reset so that decompression can
   restart from this point if previous compressed data has been damaged or if
   random access is desired.  Using Z_FULL_FLUSH too often can seriously degrade

     If deflate returns with avail_out == 0, this function must be called again
   with the same value of the flush parameter and more output space (updated
   avail_out), until the flush is complete (deflate returns with non-zero
   avail_out).  In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
   avail_out is greater than six to avoid repeated flush markers due to
   avail_out == 0 on return.


More information about the core-libs-dev mailing list