RFR: 4452735: Add GZIPOutputStream constructor to specify Deflater

Archie Cobbs acobbs at openjdk.org
Wed Jul 17 21:14:03 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 `Deflator` 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`.

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

Commit messages:
 - Add a GZIPOutputStream() constructor that takes a Deflator.

Changes: https://git.openjdk.org/jdk/pull/20226/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20226&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-4452735
  Stats: 139 lines in 2 files changed: 139 ins; 0 del; 0 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