RFR: 8271308: (fc) FileChannel.transferTo() transfers no more than Integer.MAX_VALUE bytes in one call
Brian Burkhalter
bpb at openjdk.java.net
Thu Jul 29 23:17:46 UTC 2021
On Thu, 29 Jul 2021 23:08:58 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Please consider this request to enhance `java.nio.channels.FileChannel.transferTo()` to be able to transfer more than `Integer.MAX_VALUE` bytes in one call.
The approach taken avoids adding loops inside the various private `transferToX()` methods. Without this change the new test fails. No existing tests fail because of the change.
The native method `maxTransferSize0()` might be better replaced by a constant
private static final long MAX_TRANSFER_SIZE = (long)Integer.MAX_VALUE - 1;
This would guarantee that Windows’ `TransmitFile()` would not reject a transfer as being too large (`count == Integer.MAX_VALUE`) thereby forcing a slower path and would little affect the other platforms.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4940
More information about the nio-dev
mailing list