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

Archie Cobbs acobbs at openjdk.org
Mon Nov 25 17:29:48 UTC 2024


> 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 four additional commits since the last revision:

 - 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/c6e52e0d..ab16e47d

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

  Stats: 733296 lines in 8499 files changed: 461944 ins; 214241 del; 57111 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