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

Brian Burkhalter brian.burkhalter at oracle.com
Thu Feb 15 16:54:48 UTC 2018


I updated the patch to add to j.n.f.Path

String getExtension()

instead of

boolean hasExtension(String…).

The previously mentioned use case of a given file type having multiple possible extensions may be trivially handled for example as

Set.of(“jpg”, “JPG”, “jpeg”).contains(path.getExtension())

The class javadoc of Path was also updated to put the concept of extension in context.



More information about the nio-dev mailing list