On Tue, 1 Apr 2025 17:10:08 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> 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. What about something like this? _An output stream that is created without specifying a decompressor takes responsibility for providing and managing a decompressor, including ensuring that it is properly closed after the output stream is closed. If a decompressor is specified when creating the output stream, the caller takes responsibility for managing that decompressor, including ensuring that it is properly closed after the output stream is closed._ ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23655#discussion_r2023373942