RFR: 8274112: (fc) Tune FileChannel.transferTo() [v6]

Brian Burkhalter bpb at openjdk.java.net
Fri Apr 29 22:40:36 UTC 2022


On Fri, 29 Apr 2022 16:37:59 GMT, Lance Andersen <lancea at openjdk.org> wrote:

>> test/jdk/java/nio/channels/FileChannel/TransferToChannel.java line 126:
>> 
>>> 124:                 for (int i=0; i<size; i++)
>>> 125:                     if (incoming[i] != expected[i])
>>> 126:                         throw new RuntimeException("Data corrupted");
>> 
>> Perhaps `if (!Arrays.equals(incoming, 0, size, expected, 0, size))...`
>
> Agree  but I would take it further and create a utility method so that it is reusable as it looks like you could take advantage of it later in the test(around line 175)

> Perhaps `if (!Arrays.equals(incoming, 0, size, expected, 0, size))...`

I think here the simpler `Arrays.equals(byte[],byte[])` can be used.

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

PR: https://git.openjdk.java.net/jdk/pull/5623


More information about the nio-dev mailing list