Integrated: 8326096: Deprecate getTotalIn, getTotalOut methods of java.util.zip.Inflater, java.util.zip.Deflater

Eirik Bjørsnøs eirbjo at openjdk.org
Fri Mar 8 09:41:02 UTC 2024


On Mon, 19 Feb 2024 18:35:58 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:

> Please review this PR which proposes that we officially deprecate the following four methods in the `java.util.zip` package:
> 
> * `Inflater.getTotalIn()`
> * `Inflater.getTotalOut()`
> * `Deflater.getTotalIn()`
> * `Deflater.getTotalOut()`
> 
> Since these legacy methods return `int`, they cannot safely return the number of bytes processed without the risk of losing information  about the magnitude or even sign of the returned value.
> 
> The corresponding methods `getBytesRead()` and `getBytesWritten()` methods introduced in Java 5 return `long`, and should be used instead when obtaining this information. 
> 
> Unrelated to the deprecation itself, the documentation currently does not specify what these methods are expected to return when the number of processed bytes is greater than `Integer.MAX_VALUE`. This PR aims to clarify this in the API specification.

This pull request has now been integrated.

Changeset: d0d4912c
Author:    Eirik Bjørsnøs <eirbjo at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/d0d4912c3bbc06e9a9c5273308d5f4ef7bac1b24
Stats:     28 lines in 2 files changed: 16 ins; 0 del; 12 mod

8326096: Deprecate getTotalIn, getTotalOut methods of java.util.zip.Inflater, java.util.zip.Deflater

Co-authored-by: Jaikiran Pai <jpai at openjdk.org>
Reviewed-by: lancea, alanb

-------------

PR: https://git.openjdk.org/jdk/pull/17919


More information about the core-libs-dev mailing list