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).

This pull request has now been integrated.

Changeset: bb6b0489
Author:    Eirik Bjørsnøs <eir...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/bb6b04897b5d83dd89fc11074dd66af024f9c6fc
Stats:     3 lines in 1 file changed: 2 ins; 0 del; 1 mod

8326099: GZIPOutputStream should use Deflater.getBytesRead() instead of 
Deflater.getTotalIn()

Reviewed-by: jpai

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

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

Reply via email to