RFR: 8057113: (fs) Path should have a method to obtain the filename extension [v6]

Brian Burkhalter bpb at openjdk.java.net
Tue May 3 00:37:37 UTC 2022


On Thu, 28 Apr 2022 22:14:30 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Resurrection of the proposal to add a method to obtain the filename extension originated in PR [2319](https://github.com/openjdk/jdk/pull/2319).
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8057113: String getExtension(String defaultExtension) to Optional<String> getExtension() and other changes

Commit e5240f1c10023b447a8eac91fc188dea033c9616 re-specifies `getExtension()` to return `Optional.of("")` for cases where the string representation of the `Path` has a dot (`'.'`) at the last index and `Optional.empty()` was formerly returned. A test is also added.

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

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


More information about the nio-dev mailing list