Major additions to
|Java® 2 SDK Contents|
The File class is now a true abstract representation of file and directory pathnames. These changes allow this class to better support non-Unix platforms such as Windows, which has a rich pathname syntax involving drive letters, UNC share names, and multiple separator characters. The original specification could not handle these cases because it was written in terms of simple string operations.
Fileclass has been expanded to support the following new features:
- The ability to create temporary files, and a simple delete-on-exit facility (the new methods createNewFile, createTempFile, and deleteOnExit);
- Conversion of abstract pathnames to URLs (the new method toURL);
- Access to the list of filesystem roots (the new method listRoots);
- Comparability (the new compareTo methods);
- Access to additional file attributes (the new methods isHidden, setLastModified, and setReadOnly); and
- A uniform set of methods that accept and return File objects rather than strings (the new methods getParentFile, getAbsoluteFile, getCanonicalFile, and listFiles, and the new interface FileFilter).