Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8057113

(fs) Path should have a method to obtain the filename extension

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Understanding:
      Cause Known

      Description

      For some reason Path.getFileName() returns a Path, not a String. This makes it clumsy to see if the filename has a particular extension, since you need an ugly .toString() to get the string of the Path before you can call .endsWith.

      It would be nicer if there was a recognition that manipulating extensions was a common operations on many path objects, and if there was API for that.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bpb Brian Burkhalter
                Reporter:
                jjg Jonathan Gibbons
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: