RFR: 4800398: (ch spec) Clarify Channels.newChannel(InputStream) spec

Alan Bateman alanb at openjdk.org
Fri Jul 21 06:34:39 UTC 2023


On Thu, 20 Jul 2023 18:11:15 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Clarify that the `ReadableByteChannel` returned by `Channels::newChannel` is in blocking mode.

src/java.base/share/classes/java/nio/channels/Channels.java line 264:

> 262:      * <p> The resulting channel will be in blocking mode and will not be
> 263:      * buffered; it will simply redirect its I/O operations to the given stream.
> 264:      * Closing the channel will in turn cause the stream to be closed.  </p>

ReadableByteChannel doesn't have any notion of blocking mode so might be confusing to say that it returns a channel in blocking mode. Maybe it would be simpler to just insert a sentence into the paragraph to say that reading from the resulting channel will read (and therefore might blocking reading) from the input stream?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14961#discussion_r1270275577


More information about the nio-dev mailing list