All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.io.File
The File class is intended to provide an abstraction
that deals with most of the machine dependent complexities of
files and pathnames in a machine-independent fashion.
Note that whenever a filename or path is used it is assumed that the host's file naming conventions are used.
File instance that represents the file
with the specified name in the specified directory.
File instance that represents the file
whose pathname is the given path argument.
File instance whose pathname is the
pathname of the specified directory, followed by the separator
character, followed by the name argument.
File exists.
File object is an
absolute pathname.
File
object is a directory.
File
object is a "normal" file.
File object was last modified.
File object.
File object.
File that satisfy the specified filter.
File object.
File object, including any necessary parent directories.
File object to
have the pathname given by the File argument.
Properties Public Constant
separator=String
file.separator.
Properties Public Constant separatorChar=char
file.separator. This character
separates the directory and file components in a filename.
Properties Public Constant
pathSeparator=String
path.separator.
Properties Public Constant pathSeparatorChar=char
path.separator. This character is
often used to separate filenames in a sequence of files given as a
"path list".
method File(path=String) public
File instance that represents the file
whose pathname is the given path argument.
null.
method File(path=String, -
name=String) public
File instance whose pathname is the
pathname of the specified directory, followed by the separator
character, followed by the name argument.
method File(dir=File, -
name=String) public
File instance that represents the file
with the specified name in the specified directory.
If the directory argument is null, the resulting
File instance represents a file in the
(system-dependent) current directory whose pathname is the
name argument. Otherwise, the File
instance represents a file whose pathname is the pathname of the
directory, followed by the separator character, followed by the
name argument.
method getName() returns String public
File object.
method getPath() returns String public
File object.
method getAbsolutePath() returns String public
The system property user.dir contains the current
user directory.
File.
method getCanonicalPath() returns String public Signals IOException
method getParent() returns String public
null if the separator character does not appear in
the pathname.
File object.
method exists() returns boolean public
File exists.
true if the file specified by this object
exists; false otherwise.
checkRead method is called with the pathname
of this File to see if the application is
allowed read access to the file.
method canWrite() returns boolean public
true if the application is allowed to write to
a file whose name is specified by this object;
false otherwise.
checkWrite method is called with the pathname
of this File to see if the application is
allowed write access to the file.
method canRead() returns boolean public
true if the file specified by this object exists
and the application can read the file;
false otherwise.
checkRead method is called with the pathname
of this File to see if the application is
allowed read access to the file.
method isFile() returns boolean public
File
object is a "normal" file.
A file is "normal" if it is not a directory and, in addition, satisfies other system-dependent criteria. Any non-directory file created by a Java application is guaranteed to be a normal file.
true if the file specified by this object
exists and is a "normal" file; false otherwise.
checkRead method is called with the pathname
of this File to see if the application is
allowed read access to the file.
method isDirectory() returns boolean public
File
object is a directory.
true if this File exists and is a
directory; false otherwise.
checkRead method is called with the pathname
of this File to see if the application is
allowed read access to the file.
method isAbsolute() returns boolean public
File object is an
absolute pathname. The definition of an absolute pathname is system
dependent. For example, on UNIX, a pathname is absolute if its
first character is the separator character. On Windows platforms,
a pathname is absolute if its first character is an ASCII '\' or
'/', or if it begins with a letter followed by a colon.
true if the pathname indicated by the
File object is an absolute pathname;
false otherwise.
method lastModified() returns long public
File object was last modified.
The return value is system dependent and should only be used to compare with other values returned by last modified. It should not be interpreted as an absolute time.
0L if the specified file does not exist.
checkRead method is called with the pathname
of this File to see if the application is
allowed read access to the file.
method length() returns long public
File object.
0L if the specified file does not exist.
checkRead method is called with the pathname
of this File to see if the application is
allowed read access to the file.
method mkdir() returns boolean public
File object.
true if the directory could be created;
false otherwise.
checkWrite method is called with the pathname
of this File to see if the application is
allowed write access to the file.
method renameTo(dest=File) returns boolean public
File object to
have the pathname given by the File argument.
true if the renaming succeeds;
false otherwise.
checkWrite method is called both with the
pathname of this file object and with the pathname of the
destination target object to see if the application is
allowed to write to both files.
method mkdirs() returns boolean public
File object, including any necessary parent directories.
true if the directory (or directories) could be
created; false otherwise.
checkWrite method is called with the pathname
of each of the directories that is to be created, before
any of the directories are created.
method list() returns String[] public
File object.
." and ".."
on Unix systems).
checkRead method is called with the pathname
of this File to see if the application is
allowed read access to the file.
method list(filter=FilenameFilter) returns String[] public
File that satisfy the specified filter.
." and ".."
on Unix systems).
checkRead method is called with the pathname
of this File to see if the application is
allowed read access to the file.
method delete() returns boolean public
true if the file is successfully deleted;
false otherwise.
checkDelete method is called with the
pathname of this File to see if the
application is allowed to delete the file.
method hashCode() returns int public
File object.
method equals(obj=Object) returns boolean public
true if and only if the argument is
not null and is a File object whose
pathname is equal to the pathname of this object.
true if the objects are the same;
false otherwise.
method toString() returns String public
All Packages Class Hierarchy This Package Previous Next Index