RFR: 4452735: Add GZIPOutputStream constructor to specify Deflater

Lance Andersen lancea at openjdk.org
Fri Jul 19 15:18:30 UTC 2024


On Fri, 19 Jul 2024 14:07:07 GMT, Archie Cobbs <acobbs 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.

thank you Archie.  I don't have an issue with the feature request, but given this API has been around for since JDK 1.1 and there has not been a must have push for this enhancement, I would prefer to focus on JDK-8322256 closed out and adding more overall test coverage before tackling this.
> 
> > 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.

Yes which why we should look to add additional tests, including more coverage from gzip files created via the gzip command line tool.

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

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


More information about the core-libs-dev mailing list