RFR 8057113: (fs) Path should have a method to test the filename extension
Brian Burkhalter
brian.burkhalter at oracle.com
Fri Feb 16 22:00:43 UTC 2018
Hi Roger,
On Feb 16, 2018, at 1:34 PM, Roger Riggs <Roger.Riggs at oracle.com> wrote:
> The convention for a single leading "." to indicate a hidden file is fine.
> To keep it simple, the last "." that is not the first character can be the delimiter for the extension.
>
> "." ext ""
> ".." ext ""
> ".a.b" ext "b"
> "......." ext ""
> ".....a" ext "a"
> "....a.b" ext "b"
> "..foo" ext "foo"
>
> It might be useful to check how native unix utilities parse these cases.
I did check some of those. In particular
$ basename ..foo
gives “..foo”.
I’ve kept picking away at this and the revised verbiage du moment is
* Returns the extension of this {@code Path} as a {@code String}. The
* extension is the suffix of the {@link #getFileName file name} element
* after the last dot ({@code '.'}). If however the file name is
* {@code null}, does not contain a dot, has a dot as its first character,
* the last dot is preceded only by dots, or the last character is a dot,
* then this method returns an empty {@code String}.
I hope that makes better sense.
Thanks,
Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20180216/2791831e/attachment-0001.html>
More information about the nio-dev
mailing list