RFR: 4452735: Add GZIPOutputStream constructor to specify Deflater [v4]

Archie Cobbs acobbs at openjdk.org
Sat Jan 25 16:13:11 UTC 2025


> The class `GZIPOutputStream` extends `DeflaterOutputStream`, which is logical because the GZIP encoding is based on ZLIB "deflate" encoding.
> 
> However, while `DeflaterOutputStream` provides constructors that take a custom `Deflater` argument supplied by the caller, `GZIPOutputStream` has no such constructors.
> 
> As a result, it's not possible to do entirely reasonable customization, such as configuring a `GZIPOutputStream` for a non-default compression level.
> 
> This change adds a new `GZIPOutputStream` constructor that accepts a custom `Deflater`, and also adds a basic unit test for it and all of the other `GZIPOutputStream` constructors, based on the existing test `BasicGZIPInputStreamTest.java` which does the same thing for `GZIPInputStream`.

Archie Cobbs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:

 - Add Javadoc explaining that Deflater.end() will not be invoked.
 - Merge branch 'master' into JDK-4452735
 - Bump copyright year to 2025.
 - Merge branch 'master' into JDK-4452735
 - Address review comments.
 - Merge branch 'master' into JDK-4452735
 - Merge branch 'master' into JDK-4452735
 - Add a GZIPOutputStream() constructor that takes a Deflator.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/20226/files
  - new: https://git.openjdk.org/jdk/pull/20226/files/b3a40b1c..3807de16

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=20226&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=20226&range=02-03

  Stats: 57418 lines in 3269 files changed: 22191 ins; 23198 del; 12029 mod
  Patch: https://git.openjdk.org/jdk/pull/20226.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20226/head:pull/20226

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


More information about the core-libs-dev mailing list