RFR: 4452735: Add GZIPOutputStream constructor to specify Deflater

Archie Cobbs acobbs at openjdk.org
Fri Jul 19 14:09:32 UTC 2024


On Fri, 19 Jul 2024 10:41:05 GMT, Lance Andersen <lancea at openjdk.org> wrote:

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

I think the primary use case is when you want to set a non-default compression level, e.g., "best" or "fast". This is a pretty normal thing to do and matches what people expect from the `gzip(1)` command line flags. Allowing a custom `Deflater` is the simplest way to accomplish this; it also solves some other less common use cases, e.g., you want to set "no compression" for an already compressed file, or you want to keep the `Deflater` open so you can gather stats or whatever.

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

Agreed. `GZIPOutputStream` does get some coverage in some of the `GZIPInputStream` tests, and this PR adds more testing, but certainly more is better.

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

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


More information about the core-libs-dev mailing list