RFR: 4670339: (ch) Channels.newChannel(OutputStream) should flush stream on every write [v2]
Alan Bateman
alanb at openjdk.org
Wed Mar 29 08:05:58 UTC 2023
On Tue, 28 Mar 2023 17:06:39 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Call `flush()` on the `OutputStream` before returning from `WritableByteChannelImpl::write`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 4670339: Make WritableByteChannelImpl Flushable; add newChannel(OutputStream,boolean)
src/java.base/share/classes/java/nio/channels/Channels.java line 347:
> 345: * its I/O operations to the given stream. Closing the channel will in
> 346: * turn cause the stream to be closed. The returned channel implements
> 347: * {@linkplain Flushable}; flushing the channel will flush the stream. </p>
This was just a suggestion to try but I think it's a bit too weird so I would drop that.
I think the main thing we need to decide is whether a factory method for an auto-flushing output stream is useful to have to not. Maybe we should try to survey the usages of this factory method to see if there is much usage and in what contexts.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13198#discussion_r1151541311
More information about the nio-dev
mailing list