JDK-4224436 : File.{check,get,has}Extension() to access filename extension
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.2.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1999-03-26
  • Updated: 2022-11-01
  • Resolved: 2022-11-01
Related Reports
Relates :  
Relates :  
Description
Name: vi73552			Date: 03/26/99


When dealing with files, it is occasionally necessary to
look at the extension of a file. I think a very useful
potential feature of java.io.File would be some methods
that allow checking of a file extension. Some methods that
would be most useful are:

public String getExtension()
  // returns the file extension, or
  // null if there is not one

public boolean hasExtension()
  // returns true if the file has an
  // extension of the format '.xxx'
  // and false if the file does not
  // have an extension.

public boolean checkExtension( String E )
  // returns true if E (and only E) follows
  // the last period in the filename, returns
  // false if there is no extension or if E
  // doesn't match the extension
(Review ID: 56140) 
======================================================================

Comments
Closing this issue as a duplicate of JDK-8057113.
01-11-2022

WORK AROUND Name: vi73552 Date: 03/26/99 Write my own functions - easy to do, but it isn't an effective use of my time on a programming project. ======================================================================
11-06-2004