On Sat, 17 Feb 2024 12:08:38 GMT, Eirik Bjørsnøs <eir...@openjdk.org> wrote:
> Please review this cleanup PR in preparation for deprecating > `Deflater.getTotalIn()` in JDK-8326096. > > This PR replaces `GZIPOutputStream.writeTrailer`'s call to > `Deflater.getTotalIn()` with a call to `Deflater.getBytesRead()` followed by > an explicit conversion to "modulo 2^32" (a cast to int) as described in RFC > 1952: > > > ISIZE (Input SIZE) > This contains the size of the original (uncompressed) input > data modulo 2^32. > > > Testing and verification: This should be trivially verifiable by code > inspection. Nevertheless, I wrote a test which writes Integer.MAX_VALUE +1 > bytes of uncompressed data and verified that the last four bytes written to > the file was indeed as expected. (This test is not included in this PR > because of its runtime and resource requirements). Hello Eirik, the change looks OK to me. For context, the `getTotalIn()` and `getTotalOut()` methods are being proposed for deprecation https://mail.openjdk.org/pipermail/core-libs-dev/2024-February/119321.html. `getTotalIn()` was doing the same `(int) getBytesRead()` internally, so this change should be OK. ------------- Marked as reviewed by jpai (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/17900#pullrequestreview-1887705275