Name
File
Synopsis
This class supports a platform-independent
definition of file and
directory names. It also
provides methods to list the files in a directory; check the
existence, readability, writability, type, size, and modification
time of files and directories; make new directories; rename files and
directories; delete files and directories; and create and delete
temporary and lock files.
The constants
defined by this class are the platform-dependent directory and
path-separator characters, available as a String
and a char.
getName( ) returns the
name of the File with any directory names omitted.
getPath( ) returns the full name of the file,
including the directory name. getParent( ) and
getParentFile( ) return the directory that
contains the File; the only difference between the
two methods is that one returns a String, while
the other returns a File. isAbsolute(
) tests whether the File is an
absolute
specification. If not, getAbsolutePath( ) returns
an absolute filename created by appending the relative filename to
the current working directory. getAbsoluteFile( )
returns the equivalent absolute File object.
getCanonicalPath( ) and getCanonicalFile(
) are similar methods: they return an absolute filename or
File object that has been converted to its
system-dependent canonical form. This can be useful
when comparing two File objects to see if they
refer to the same file or directory. In Java 1.4 and later, the
toURI( )
method returns a
java.net.URI object that ...