RFR: 8275840: Testing FileChannel.transferTo(FileChannel) with more than 2 GB of data
Brian Burkhalter
bpb at openjdk.java.net
Mon Oct 25 20:59:10 UTC 2021
On Sat, 23 Oct 2021 15:51:20 GMT, Markus KARG <duke at openjdk.java.net> wrote:
> Testing `FileChannel.transferTo(FileChannel)` with more than 2 GB of data is covering the case that *multiple* iterations of `FileChannel.transferTo(FileChannel)` are actually performed by the test.
>
> This change was requested Alan Bateman @AlanBateman.
test/jdk/java/nio/channels/Channels/TransferTo.java line 151:
> 149:
> 150: // comparing reported transferred bytes, must be 3 GB
> 151: assertEquals(count, 3L * 1024 * 1024 * 1024);
Also it would be better to use constants. One option is
int NUM_WRITES = 3*1024;
int BYTES_PER_WRITE = 1024*1024;
in which case the second parameter of the first `assertEquals()` would be `(long)NUM_WRITES*BYTES_PER_WRITE`.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6093
More information about the nio-dev
mailing list