RFR: 8298318: (fs) APIs for handling filename extensions

Brian Burkhalter bpb at openjdk.org
Thu Nov 2 17:58:01 UTC 2023


On Tue, 17 Oct 2023 19:52:14 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Add to `java.nio.file.Path` a method `getExtension` to retrieve the `Path`'s extension, and companion methods `removeExtension` and `addExtension`.

Thanks for the suggestion; I think it looks promising. I wonder however whether the notion of `withoutExtension` needs to be explicit.

     * Path p = withoutExtension();
     * if (extension == null || extension.isEmpty()) {
     *     return p;
     *

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

PR Comment: https://git.openjdk.org/jdk/pull/16226#issuecomment-1791264920


More information about the nio-dev mailing list