RFR: 4452735: Add GZIPOutputStream constructor to specify Deflater

Lance Andersen lancea at openjdk.org
Fri Jul 19 10:43:30 UTC 2024


On Wed, 17 Jul 2024 21:07:23 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:

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

I understand the request here, but is there a current use case for needing a custom Deflater? 

Before adding additional features, I think GZIP could benefit with more test coverage.

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

PR Comment: https://git.openjdk.org/jdk/pull/20226#issuecomment-2238878240


More information about the core-libs-dev mailing list