RFR: 8265891: (ch) InputStream returned by Channels.newInputStream should override transferTo
Brian Burkhalter
bpb at openjdk.java.net
Thu Jun 17 17:03:22 UTC 2021
On Tue, 8 Jun 2021 20:20:58 GMT, Markus KARG <github.com+1701815+mkarg at openjdk.org> wrote:
>> src/java.base/share/classes/sun/nio/ch/ChannelOutputStream.java line 113:
>>
>>> 111: if ((off < 0) || (off > bs.length) || (len < 0) ||
>>> 112: ((off + len) > bs.length) || ((off + len) < 0)) {
>>> 113: throw new IndexOutOfBoundsException();
>>
>> Could the bounds checking be done as follows?
>>
>> `Objects.checkFromIndexSize(off, len, bs.length);`
>>
>> Same comment applies to lines 146 and 219 in `java.nio.channels.Channels`.
>
> I'd like to abstain from changes in ChannelOutputStream, as I did not write that code at all. It is simply moved from being an inner class. Please let's concentrate on the code I actually wrote in this PR. Thanks.
That's fine. Sometimes we make small changes like that while we are in nearby code.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4263
More information about the nio-dev
mailing list