RFR: 6980847: (fs) Files.copy needs to be tuned [v9]

Brian Burkhalter bpb at openjdk.org
Wed Jun 22 16:54:55 UTC 2022


On Wed, 22 Jun 2022 16:48:50 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   6980847: Remove use of Files.size()
>
> src/java.base/windows/classes/sun/nio/fs/WindowsFileCopy.java line 188:
> 
>> 186:             final int flags = ((!followLinks) ? COPY_FILE_COPY_SYMLINK : 0) |
>> 187:                               ((sourceAttrs.size() > UNBUFFERED_IO_THRESHOLD) ?
>> 188:                                   COPY_FILE_NO_BUFFERING : 0);
> 
> Would this be easier to read:
> 
> 
>         int flags = (followLinks) ? 0 : COPY_FILE_COPY_SYMLINK;
>         if (sourceAttrs.size() > UNBUFFERED_IO_THRESHOLD) {
>             flags |= COPY_FILE_NO_BUFFERING;
>         }

I did not do that because `flags` is final but I guess it need not be.

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

PR: https://git.openjdk.org/jdk/pull/9161


More information about the nio-dev mailing list