Returns the length of the file denoted by this abstract pathname. The return value is unspecified if this pathname denotes a directory.
Read-only.
Returns the name of the file or directory denoted by this abstract pathname. This is just the last name in the pathname's name sequence. If the pathname's name sequence is empty, then the empty string is returned.
Read-only.
Returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory.
The <em>parent</em> of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.
Read-only.
Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory.
The <em>parent</em> of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.
Read-only.
Converts this abstract pathname into a pathname string. The resulting string uses the default name-separator character to separate the names in the name sequence.
Read-only.
Returns the absolute pathname string of this abstract pathname.
If this abstract pathname is already absolute, then the pathname string is simply returned as if by the path method.
If this abstract pathname is the empty abstract pathname then the pathname string of the current user directory, which is named by the system property user.dir , is returned. Otherwise this pathname is resolved in a system-dependent way. On UNIX systems, a relative pathname is made absolute by resolving it against the current user directory. On Microsoft Windows systems, a relative pathname is made absolute by resolving it against the current directory of the drive named by the pathname, if any; if not, it is resolved against the current user directory.
Read-only.
Returns the absolute form of this abstract pathname. Equivalent to new File(this.getAbsolutePath()) .
Read-only.
Returns the canonical pathname string of this abstract pathname.
A canonical pathname is both absolute and unique. The precise definition of canonical form is system-dependent. This method first converts this pathname to absolute form if necessary, as if by invoking the absolutePath method, and then maps it to its unique form in a system-dependent way. This typically involves removing redundant names such as "." and ".." from the pathname, resolving symbolic links (on UNIX platforms), and converting drive letters to a standard case (on Microsoft Windows platforms).
Every pathname that denotes an existing file or directory has a unique canonical form. Every pathname that denotes a nonexistent file or directory also has a unique canonical form. The canonical form of the pathname of a nonexistent file or directory may be different from the canonical form of the same pathname after the file or directory is created. Similarly, the canonical form of the pathname of an existing file or directory may be different from the canonical form of the same pathname after the file or directory is deleted.
Read-only.
Returns the canonical form of this abstract pathname. Equivalent to new File(this.getCanonicalPath()) .
Read-only.
The system-dependent default name-separator character, represented as a string for convenience. This string contains a single character.
The system-dependent path-separator character, represented as a string for convenience. This string contains a single character.
Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a directory, then the directory must be empty in order to be deleted.
Tests whether this abstract pathname is absolute. The definition of absolute pathname is system dependent. On UNIX systems, a pathname is absolute if its prefix is "/" . On Microsoft Windows systems, a pathname is absolute if its prefix is a drive specifier followed by "\\" , or if its prefix is "\\\\" .
Converts this abstract pathname into a file: URL. The exact form of the URL is system-dependent. If it can be determined that the file denoted by this abstract pathname is a directory, then the resulting URL will end with a slash.
Usage note: This method does not automatically escape characters that are illegal in URLs. It is recommended that new code convert an abstract pathname into a URL by first converting it into a URI, via the toURI method, and then converting the URI into a URL via the java.net.URI#toURL() method.
See also: toURI()
Constructs a file: URI that represents this abstract pathname.
The exact form of the URI is system-dependent. If it can be determined that the file denoted by this abstract pathname is a directory, then the resulting URI will end with a slash.
For a given abstract pathname f, it is guaranteed that
new File(f.toURI()).equals(f.getAbsoluteFile())
so long as the original abstract pathname, the URI, and the new abstract pathname are all created in (possibly different invocations of) the same Java virtual machine. Due to the system-dependent nature of abstract pathnames, however, this relationship typically does not hold when a file: URI that is created in a virtual machine on one operating system is converted into an abstract pathname in a virtual machine on a different operating system.
See also: File(uri)
Tests whether the application can read the file denoted by this abstract pathname.
Tests whether the application can modify the file denoted by this abstract pathname.
Tests whether the file or directory denoted by this abstract pathname exists.
Tests whether the file denoted by this abstract pathname is a directory.
Tests whether the file denoted by this abstract pathname is a normal file. A file is <em>normal</em> 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.
Tests whether the file named by this abstract pathname is a hidden file.
The exact definition of <em>hidden</em> is system-dependent. On UNIX systems, a file is considered to be hidden if its name begins with a period character ('.' ). On Microsoft Windows systems, a file is considered to be hidden if it has been marked as such in the filesystem.
Returns the time that the file denoted by this abstract pathname was last modified.
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the list([filter]) method, except that the strings in the returned array must satisfy the filter. If the given filter is null then all names are accepted. Otherwise, a name satisfies the filter if and only if the value true results when the FilenameFilter#accept method of the filter is invoked on this abstract pathname and the name of a file or directory in the directory that it denotes.
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the listFiles([filter]) method, except that the pathnames in the returned array must satisfy the filter. If the given filter is null then all pathnames are accepted. Otherwise, a pathname satisfies the filter if and only if the value results when the FilenameFilter#accept method of the filter is invoked on this abstract pathname and the name of a file or directory in the directory that it denotes.
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the listFiles([filter]) method, except that the pathnames in the returned array must satisfy the filter. If the given filter is null then all pathnames are accepted. Otherwise, a pathname satisfies the filter if and only if the value results when the FileFilter#accept(java.io.File) method of the filter is invoked on the pathname.
Creates the directory named by this abstract pathname.
Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories. Note that if this operation fails it may have succeeded in creating some of the necessary parent directories.
Renames the file denoted by this abstract pathname.
Many aspects of the behavior of this method are inherently platform-dependent: The rename operation might not be able to move a file from one filesystem to another, it might not be atomic, and it might not succeed if a file with the destination abstract pathname already exists.
The return value should always be checked to make sure that the rename operation was successful.
Sets the last-modified time of the file or directory named by this abstract pathname.
All platforms support file-modification times to the nearest second, but some provide more precision. The argument will be truncated to fit the supported precision. If the operation succeeds and no intervening operations on the file take place, then the next invocation of the lastModified() method will return the (possibly truncated) time argument that was passed to this method.
Marks the file or directory named by this abstract pathname so that only read operations are allowed. After invoking this method the file or directory is guaranteed not to change until it is either deleted or marked to allow write access. Whether or not a read-only file or directory may be deleted depends upon the underlying system.
Copyright © 2001-2010 Jürg Lehni, Scratchdisk.com. All Rights Reserved.