RFR: 8057113: (fs) Path should have a method to obtain the filename extension [v18]
Roger Riggs
rriggs at openjdk.org
Mon Oct 3 15:30:23 UTC 2022
On Mon, 1 Aug 2022 21:54:22 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: Remove API note
For a filename to have an extension, then I think there needs to be a non-empty root part.
So:
".z", root = ".z" ext = null
"z.", root = "z" ext = ""
"..z", root = "." ext = "z"
"...foo", root = "..", ext = "foo"
".....", root = "....", ext = ""
Algorithm wise, you can find the last "." and check if there is a non-empty string before it.
Scanning of the prefix is not necessary.
-------------
PR: https://git.openjdk.org/jdk/pull/8066
More information about the nio-dev
mailing list