Sg2.0
File
Packages

Constructors

Parameters:
parent: String
child: String
Parameters:
parent: File
child: String
Parameters:
uri: URI

Functions

Tests whether the application can read the file denoted by this abstract pathname.
Returns:
Boolean - true if and only if the file specified by this abstract pathname exists <em>and</em> can be read by the application; false otherwise
Throws:
SecurityException - If a security manager exists and its java.lang.SecurityManager.checkRead(java.lang.String) method denies read access to the file
Tests whether the application can modify the file denoted by this abstract pathname.
Returns:
Boolean - true if and only if the file system actually contains a file denoted by this abstract pathname <em>and</em> the application is allowed to write to the file; false otherwise.
Throws:
SecurityException - If a security manager exists and its java.lang.SecurityManager.checkWrite(java.lang.String) method denies write access to the file
Tests whether the file or directory denoted by this abstract pathname exists.
Returns:
Boolean - true if and only if the file or directory denoted by this abstract pathname exists; false otherwise
Throws:
SecurityException - If a security manager exists and its java.lang.SecurityManager.checkRead(java.lang.String) method denies read access to the file or directory
Returns the time that the file denoted by this abstract pathname was last modified.
Returns:
Number - A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs
Throws:
SecurityException - If a security manager exists and its java.lang.SecurityManager.checkRead(java.lang.String) method denies read access to the file
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 @link: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.
Parameters:
filter: FilenameFilter
Returns:
Array of String - An array of strings naming the files and directories in the directory denoted by this abstract pathname that were accepted by the given filter. The array will be empty if the directory is empty or if no names were accepted by the filter.
Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.
Throws:
SecurityException - If a security manager exists and its java.lang.SecurityManager.checkRead(java.lang.String) method denies read access to the directory
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 true results when the @link: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.
Parameters:
filter: FilenameFilter - A filename filter
Returns:
Array of File - An array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.
Throws:
SecurityException - If a security manager exists and its java.lang.SecurityManager.checkRead(java.lang.String) method denies read access to the directory
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 true results when the @link:FileFilter#accept(java.io.File) method of the filter is invoked on the pathname.
Parameters:
filter: FileFilter - A file filter
Returns:
Array of File - An array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.
Throws:
SecurityException - If a security manager exists and its java.lang.SecurityManager.checkRead(java.lang.String) method denies read access to the directory
Creates the directory named by this abstract pathname.
Returns:
Boolean - true if and only if the directory was created; false otherwise
Throws:
SecurityException - If a security manager exists and its java.lang.SecurityManager.checkWrite(java.lang.String) method does not permit the named directory to be created
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.
Returns:
Boolean - true if and only if the directory was created, along with all necessary parent directories; false otherwise
Throws:
SecurityException - If a security manager exists and its java.lang.SecurityManager.checkRead(java.lang.String) method does not permit verification of the existence of the named directory and all necessary parent directories; or if the java.lang.SecurityManager.checkWrite(java.lang.String) method does not permit the named directory and all necessary parent directories to be created
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.

Parameters:
dest: File - The new abstract pathname for the named file
Returns:
Boolean - true if and only if the renaming succeeded; false otherwise
Throws:
SecurityException - If a security manager exists and its java.lang.SecurityManager.checkWrite(java.lang.String) method denies write access to either the old or new pathnames
NullPointerException - If parameter dest is null
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.

Parameters:
time: Number - The new last-modified time, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)
Returns:
Boolean - true if and only if the operation succeeded; false otherwise
Throws:
IllegalArgumentException - If the argument is negative
SecurityException - If a security manager exists and its java.lang.SecurityManager.checkWrite(java.lang.String) method denies write access to the named file
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.
Returns:
Boolean - true if and only if the operation succeeded; false otherwise
Throws:
SecurityException - If a security manager exists and its java.lang.SecurityManager.checkWrite(java.lang.String) method denies write access to the named file
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 <blockquote> new java.io.File(java.net.URI)(&nbsp;f.toURI()).equals(&nbsp;f.getAbsoluteFile()()) </blockquote> 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.

Returns:
URI - An absolute, hierarchical URI with a scheme equal to "file", a path representing this abstract pathname, and undefined authority, query, and fragment components
See also:java.io.File(java.net.URI), URI, java.net.URI.toURL()
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.

Returns:
URL - A URL object representing the equivalent file URL
Throws:
MalformedURLException - If the path cannot be parsed as a URL
See also:toURI(), URI, java.net.URI.toURL(), URL