Inflater nowrap and padding byte requirement

Dawid Weiss dawid.weiss at gmail.com
Fri Jan 12 10:08:48 UTC 2018


Hello,

The javadoc for Inflater states that:

     * Note: When using the 'nowrap' option it is also necessary to provide
     * an extra "dummy" byte as input. This is required by the ZLIB native
     * library in order to support certain optimizations.

This doesn't seem to be a requirement anymore in newer zlib versions,
as clarified
by Mark Adler himself [1]. The changelog for zlib 1.2.0 indeed
mentions this "zero byte"
padding isn't required anymore [2]:

Changes in 1.2.0 (9 March 2003)
[...]
    - Raw inflate no longer needs an extra dummy byte at end

Perhaps it'd make sense to remove it from the JavaDoc, so that there's
 no need to complicate
downstream code?

Dawid

[1] https://stackoverflow.com/a/9779941
[2] https://www.zlib.net/ChangeLog.txt


More information about the core-libs-dev mailing list