RFD: Should java.util.zip.[In|De]flater.getTotal[In|Out] be deprecated?

Eirik Bjørsnøs eirbjo at gmail.com
Fri Feb 16 19:20:31 UTC 2024


Hi,

Initially, the Deflater and Inflater classes in java.util.zip only
supported up to 2GB of inflated or deflated data, the reason being that
their getTotalIn and getTotalOut methods returns an int.

Around 2004, this limitation was remedied by introducing the new methods
getBytesRead and getBytesWritten returning long. The legacy methods
getTotalIn and getTotalOut were updated to simply delegate to the new
method with an added cast to int.

The legacy methods include notes in their Javadoc similar to this:

     * <p>Since the number of bytes may be greater than
>      * Integer.MAX_VALUE, the {@link #getBytesRead()} method is now
>      * the preferred means of obtaining this information.</p>


but these methods are not marked as @Deprecated in Javadoc or with
annotations.

Is there any good reason why these four methods have not been officially
deprecated in the past? If not, would it be worthwhile doing so now?

Cheers,
Eirik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20240216/dc107576/attachment.htm>


More information about the core-libs-dev mailing list