RFR 8057113: (fs) Path should have a method to test the filename extension

Roger Riggs Roger.Riggs at Oracle.com
Thu Feb 15 20:18:47 UTC 2018


Hi Brian,

Possibly a premature optimization but the API spec should say "as if 
getFileName()".
Perhaps the implementation can avoid actually creating a new Path and 
just look
at the last element to extract the extension.

$.02, Roger


On 2/15/2018 12:59 PM, Brian Burkhalter wrote:
> Daniel / Alan,
>
> On Feb 15, 2018, at 9:22 AM, Alan Bateman <Alan.Bateman at oracle.com 
> <mailto:Alan.Bateman at oracle.com>> wrote:
>
>> On 15/02/2018 17:04, Daniel Fuchs wrote:
>>> Hi Brian,
>>>
>>> 185         String path = toString();
>>>
>>> shouldn't this be
>>>
>>> String path = getFileName().toString()?
>
> That would simplify things.
>
>>> I wonder if the specification of getExtension() should
>>> be defined has being a substring of getFileName()?
>
> Seems like a good idea.
>
>> Right, there are a couple of issues that follow on from that, esp. 
>> when you get into Path objects that only have a root component (C: or 
>> / for example).
>
> If getFileName() is null then the extension would be empty, at least 
> according to the direction in which I’ve been going.
>
> Thanks,
>
> Brian



More information about the nio-dev mailing list