RFR: 4619075: (ch) newChannel() should return Gathering/ScatteringByteChannel [v3]
Alan Bateman
alanb at openjdk.java.net
Tue Oct 19 07:03:50 UTC 2021
On Thu, 14 Oct 2021 14:54:50 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> One other possibility I had thought of was to change `newChannel(InputStream)` and `newChannel(OutputStream)` to respectively return a `ScatteringByteChannel` and a `GatheringByteChannel` without changing the return types of the methods from their current declarations and instead calling out what is in fact returned in the javadoc.
Yes, although might be a bit icky. Another possibility is to add a default method to ReadableByteChannel. I'm in two minds as to whether we need to do anything here as I haven't seen many cases where someone wants to do scattering read ops on channels backed by input streams.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5922
More information about the nio-dev
mailing list