RFR: 8283335 : Add exists and readAttributesIfExists methods to FileSystemProvider
Lance Andersen
lancea at openjdk.org
Wed Jun 22 19:58:53 UTC 2022
On Wed, 22 Jun 2022 19:22:50 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Hi,
>>
>> Please review the following patch which will:
>>
>> - Enhance the java.nio.file.spi.FileSystemProvider abstract class to include the methods
>>
>> - public boolean exists(Path path, LinkOption... options)
>> - public <A extends BasicFileAttributes> A readAttributesIfExists(Path path, Class<A> type, LinkOption... options)
>>
>>
>> This change allows for providers to provide optimizations when the file's attributes are not needed.
>>
>> Mach5 tiers 1 - 3 run clean with this change
>>
>> The CSR may be viewed at [JDK-8283336](https://bugs.openjdk.org/browse/JDK-8283336)
>>
>>
>> Best,
>> Lance
>
> src/java.base/share/classes/java/nio/file/spi/FileSystemProvider.java line 1184:
>
>> 1182: * is present then symbolic links are not followed and the method
>> 1183: * {@link #readAttributes(Path, Class, LinkOption...)} is called
>> 1184: * to determine whether a file exists.
>
> Indentation is off at lines 1183-1184.
Thanks for catching that. Will be addressed in the next push
> src/java.base/share/classes/java/nio/file/spi/FileSystemProvider.java line 1218:
>
>> 1216:
>> 1217: /**
>> 1218: * Reads a file's attributes as a bulk operation if it exists.
>
> Maybe instead "it" put "the file"?
I can if you think that is better. I followed the wording for `FileSystemProvider::deleteIfExists` trying to be consistent
-------------
PR: https://git.openjdk.org/jdk/pull/9249
More information about the core-libs-dev
mailing list