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

Reviewed-by: jpai
This commit is contained in:
Eirik Bjørsnøs 2024-02-26 14:15:24 +00:00
parent 490825fb91
commit bb6b04897b

View file

@ -212,7 +212,9 @@ public class GZIPOutputStream extends DeflaterOutputStream {
*/
private void writeTrailer(byte[] buf, int offset) throws IOException {
writeInt((int)crc.getValue(), buf, offset); // CRC-32 of uncompr. data
writeInt(def.getTotalIn(), buf, offset + 4); // Number of uncompr. bytes
// RFC 1952: Size of the original (uncompressed) input data modulo 2^32
int iSize = (int) def.getBytesRead();
writeInt(iSize, buf, offset + 4);
}
/*