RFR: 8066583: DeflaterInput/OutputStream and InflaterInput/OutputStream should explain responsibility for freeing resources [v6]
Alan Bateman
alanb at openjdk.org
Tue Apr 1 17:13:21 UTC 2025
On Tue, 1 Apr 2025 14:50:01 GMT, Chen Liang <liach at openjdk.org> wrote:
>> It's hard for me to guess what prompted that question, but I'll take a guess - are you asking this question to decide whether we should reword the pre-existing javadoc on these constructors to explicitly state that a new decompressor/compressor instance gets created for each instance of the stream? If so, then my opinion is that we shouldn't change that part of the existing doc.
>>
>> If you meant something else, then please add the details and we can decide if any additional changes are necessary to the text.
>
> My opinion is that: if it is possible for another implementation to share the backing in/deflator (such as via thread-local instances) that does not always need to be closed when an in/output stream is closed, then we should not specify in a way that rules out such an implementation.
The deflater is exposed to subclasses via a protected field so it's part of the API. I think what Jai has is good but I'm nervous about the word "default" as it suggests a global default where as it's a deflater for each output stream.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23655#discussion_r2023286259
More information about the core-libs-dev
mailing list