Codereview request for 7188852: Move implementation of De/Inflater.getBytesRead/Writtten() to java from native

Andrew Hughes ahughes at
Fri Aug 3 17:50:21 UTC 2012

----- Original Message -----
> Hi
> This is the change to move the implementation of
> De/Inflater.getBytesRead/Written()
> from native to Java. Current JDK implementation uses zlib's
> z_stream.total_in/out fields,
> which are "uLong" type in original zlib source code. This may limit
> these two counters
> to 4GB on 32-bit OS [1].  These two fields are currently patched to
> "long long" in JDK to
> support the > 4G counting. It is suggested that it might be better to
> move this > 4G
> counting support to java level to remove the dependency on patching
> the
> original zlib
> source code, which might be critical in situation that Java runtime
> prefers to use OS
> bundled zlib, instead of the JDK bundled zlib library.
> Here is the webrev
> The test case attached only tests upto 128M by default (for running
> in
> auto testing).
> The test can be run manually with option "large" to test > 4G
> de/inflating. It takes > 4
> minutes to compress/decompress 5G bytes on my linux box, guess it's
> probably not
> desirable to hold each/every run for so long in auto setting.
> Thanks,
> Sherman
> [1]

The patch looks good to me.  I've also built and tested it, both with
the normal and large scenarios, and with in-tree and system zlib (the
latter requiring my defines.h patch) and all seems fine.
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (

PGP Key: 248BDC07 (
Fingerprint = EC5A 1F5E C0AD 1D15 8F1F  8F91 3B96 A578 248B DC07

More information about the core-libs-dev mailing list