|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.sdsc.grid.io.GeneralFile
edu.sdsc.grid.io.local.LocalFile
public class LocalFile
The LocalFile class is a wrapper class for the java.io.File class. Use it as you would a regular File object. The localFile.getFile() method will return a java.io.File object for those situations where a true java.io.File is required.
LocalFile includes dummy methods for the local file's metadata.
File,
GeneralFile| Field Summary | |
|---|---|
static java.lang.String |
pathSeparator
The system-dependent path-separator character, represented as a string for convenience. |
static char |
pathSeparatorChar
The system-dependent path-separator character. |
static java.lang.String |
separator
The system-dependent default name-separator character, represented as a string for convenience. |
static char |
separatorChar
The system-dependent default name-separator character. |
| Fields inherited from class edu.sdsc.grid.io.GeneralFile |
|---|
BUFFER_MAX_SIZE, directory, fileName, fileSystem, PATH_SEPARATOR, PATH_SEPARATOR_CHAR |
| Constructor Summary | |
|---|---|
LocalFile(java.io.File file)
Creates a new File instance from a file object. |
|
LocalFile(java.io.File file,
java.lang.String child)
Creates a new File instance from a file object. |
|
LocalFile(LocalFile directory,
java.lang.String child)
Creates a new LocalFile instance from a parent abstract pathname and a child pathname string. |
|
LocalFile(java.lang.String filePath)
Creates a new LocalFile instance by converting the given pathname string into an abstract pathname. |
|
LocalFile(java.lang.String directory,
java.lang.String child)
Creates a new LocalFile instance from a parent pathname string and a child pathname string. |
|
LocalFile(java.net.URI uri)
Creates a new LocalFile instance by converting the given file: URI into an abstract pathname. |
|
| Method Summary | |
|---|---|
boolean |
canRead()
Tests whether the application can read the file denoted by this abstract pathname. |
boolean |
canWrite()
Tests whether the application can modify to the file denoted by this abstract pathname. |
int |
compareTo(GeneralFile pathName)
Compares two abstract pathnames lexicographically. |
int |
compareTo(java.lang.Object o)
Compares this abstract pathname to another object. |
void |
copyFrom(GeneralFile file)
Copies this file to another file. |
void |
copyFrom(GeneralFile file,
boolean forceOverwrite)
Copies this file to another file. |
void |
copyTo(GeneralFile file)
Copies this file to another file. |
void |
copyTo(GeneralFile file,
boolean forceOverwrite)
Copies this file to another file. |
boolean |
createNewFile()
Atomically creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist. |
static GeneralFile |
createTempFile(java.lang.String prefix,
java.lang.String suffix)
Creates an empty file in the default temporary-file directory, using the given prefix and suffix to generate its name. |
static GeneralFile |
createTempFile(java.lang.String prefix,
java.lang.String suffix,
GeneralFile directory)
Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name. |
boolean |
delete()
Deletes the file or directory denoted by this abstract pathname. |
void |
deleteOnExit()
Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates. |
boolean |
equals(java.lang.Object obj)
Tests this abstract pathname for equality with the given object. |
boolean |
exists()
Tests whether the file denoted by this abstract pathname exists. |
protected void |
finalize()
Finalizes the object by explicitly letting go of each of its internally held values. |
GeneralFile |
getAbsoluteFile()
Returns the absolute form of this abstract pathname. |
java.lang.String |
getAbsolutePath()
Returns the absolute pathname string of this abstract pathname. |
GeneralFile |
getCanonicalFile()
Returns the canonical form of this abstract pathname. |
java.lang.String |
getCanonicalPath()
Returns the canonical pathname string of this abstract pathname. |
java.io.File |
getFile()
Returns the internal file object. |
protected java.lang.String |
getHomeDirectory()
Gets the home directory to be used with this LocalFile object. |
java.util.Properties |
getMetaData()
Dummy method for local file metadata. |
java.lang.String |
getName()
Returns the name of the file or directory denoted by this abstract pathname. |
java.lang.String |
getParent()
Returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory. |
GeneralFile |
getParentFile()
Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory. |
java.lang.String |
getPath()
Converts this abstract pathname into a pathname string. |
java.lang.String |
getPathSeparator()
This method gets the path separator as defined by the local system. |
char |
getPathSeparatorChar()
This method gets the path separator char as defined by the local system. |
int |
hashCode()
Computes a hash code for this abstract pathname. |
boolean |
isAbsolute()
Tests whether this abstract pathname is absolute. |
boolean |
isDirectory()
Tests whether the file denoted by this abstract pathname is a directory. |
boolean |
isFile()
Tests whether the file denoted by this abstract pathname is a normal file. |
boolean |
isHidden()
Tests whether the file named by this abstract pathname is a hidden file. |
long |
lastModified()
Returns the time that the file denoted by this abstract pathname was last modified. |
long |
length()
Returns the length of the file denoted by this abstract pathname. |
java.lang.String[] |
list()
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname. |
java.lang.String[] |
list(java.io.FilenameFilter filter)
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. |
GeneralFile[] |
listFiles()
Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname. |
GeneralFile[] |
listFiles(java.io.FileFilter filter)
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. |
GeneralFile[] |
listFiles(java.io.FilenameFilter filter)
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. |
java.util.Iterator |
listIterator()
Iterates through the directory/collection/container list. |
static GeneralFile[] |
listRoots()
List the available filesystem roots. |
boolean |
mkdir()
Creates the directory named by this abstract pathname. |
boolean |
mkdirs()
Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories. |
boolean |
renameTo(GeneralFile dest)
Renames the file denoted by this abstract pathname. |
protected void |
setDirectory(java.lang.String dir)
Set the directory. |
protected void |
setFileName(java.lang.String fileName)
Set the file name. |
boolean |
setLastModified(long time)
Sets the last-modified time of the file or directory named by this abstract pathname. |
boolean |
setReadOnly()
Marks the file or directory named by this abstract pathname so that only read operations are allowed. |
java.lang.String |
toString()
Returns the pathname string of this abstract pathname. |
java.net.URI |
toURI()
Constructs a file: URI that represents this abstract pathname. |
java.net.URL |
toURL()
Converts this abstract pathname into a file: URL. |
| Methods inherited from class edu.sdsc.grid.io.GeneralFile |
|---|
checksum, firstQueryResult, getFileSystem, list, listRoots, modifyMetaData, query, query, query, setFileSystem |
| Methods inherited from class java.lang.Object |
|---|
clone, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final char separatorChar
file.separator. On UNIX systems the value of this
field is '/'; on Microsoft Windows systems it is '\\'.
System.getProperty(java.lang.String)public static final java.lang.String separator
separatorChar.
public static final char pathSeparatorChar
path.separator. This character is used to
separate filenames in a sequence of files given as a path list.
On UNIX systems, this character is ':'; on Microsoft Windows systems it
is ';'.
System.getProperty(java.lang.String)public static final java.lang.String pathSeparator
pathSeparatorChar.
| Constructor Detail |
|---|
public LocalFile(java.lang.String filePath)
java.lang.NullPointerException - - If the pathname argument is null
public LocalFile(java.lang.String directory,
java.lang.String child)
java.lang.NullPointerException - - If child is null
public LocalFile(LocalFile directory,
java.lang.String child)
java.lang.NullPointerException - - If child is nullpublic LocalFile(java.io.File file)
java.lang.NullPointerException - - If file is null
public LocalFile(java.io.File file,
java.lang.String child)
java.lang.NullPointerException - - If child is nullpublic LocalFile(java.net.URI uri)
java.lang.NullPointerException - - If uri is null
java.lang.IllegalArgumentException - -
If the preconditions on the parameter do not hold| Method Detail |
|---|
protected void finalize()
throws java.lang.Throwable
finalize in class GeneralFilejava.lang.Throwable
public java.util.Iterator listIterator()
throws java.io.IOException
java.io.IOExceptionprotected void setDirectory(java.lang.String dir)
setDirectory in class GeneralFiledir - The directory path, need not be absolute.protected void setFileName(java.lang.String fileName)
setFileName in class GeneralFilefileName - The file name or fileName plus some or all of the
directory path.public java.io.File getFile()
public java.util.Properties getMetaData()
public java.lang.String getPathSeparator()
getPathSeparator in class GeneralFilepublic char getPathSeparatorChar()
getPathSeparatorChar in class GeneralFileprotected java.lang.String getHomeDirectory()
java.lang.NullPointerException - if fileSystem is null.
public void copyTo(GeneralFile file)
throws java.io.IOException
copyTo in class GeneralFilefile - The file to receive the data.
java.lang.NullPointerException - If file is null.
java.io.IOException - If an IOException occurs.
public void copyTo(GeneralFile file,
boolean forceOverwrite)
throws java.io.IOException
copyTo in class GeneralFilefile - The file to receive the data.
java.lang.NullPointerException - If file is null.
java.io.IOException - If an IOException occurs.
public void copyFrom(GeneralFile file)
throws java.io.IOException
copyFrom in class GeneralFilefile - The file to receive the data.
java.lang.NullPointerException - If file is null.
java.io.IOException - If an IOException occurs.
public void copyFrom(GeneralFile file,
boolean forceOverwrite)
throws java.io.IOException
copyFrom in class GeneralFilefile - The file to receive the data.
java.lang.NullPointerException - If file is null.
java.io.IOException - If an IOException occurs.public boolean canRead()
canRead in class GeneralFiletrue if and only if the file specified by this
abstract pathname exists and can be read; otherwise
false.public boolean canWrite()
canWrite in class GeneralFiletrue if and only if the file system actually
contains a file denoted by this abstract pathname and
the application is allowed to write to the file; otherwise
false.public int compareTo(GeneralFile pathName)
compareTo in class GeneralFilepublic int compareTo(java.lang.Object o)
compareTo in interface java.lang.ComparablecompareTo in class GeneralFileo - The Object to be compared to this abstract
pathname
public boolean createNewFile()
throws java.io.IOException
createNewFile in class GeneralFilejava.io.IOException
public static GeneralFile createTempFile(java.lang.String prefix,
java.lang.String suffix)
throws java.io.IOException
java.io.IOException
public static GeneralFile createTempFile(java.lang.String prefix,
java.lang.String suffix,
GeneralFile directory)
throws java.io.IOException
java.io.IOExceptionpublic boolean delete()
delete in class GeneralFilepublic void deleteOnExit()
deleteOnExit in class GeneralFilepublic boolean equals(java.lang.Object obj)
equals in class GeneralFileobj - The object to be compared with this abstract pathname
true if and only if the objects are the same;
false otherwisepublic boolean exists()
exists in class GeneralFiletrue if and only if the file denoted by this
abstract pathname exists; false otherwisepublic GeneralFile getAbsoluteFile()
getAbsoluteFile in class GeneralFilepublic java.lang.String getAbsolutePath()
getAbsolutePath in class GeneralFile
public GeneralFile getCanonicalFile()
throws java.io.IOException
getCanonicalFile in class GeneralFilejava.io.IOException - If an I/O error occurs, which is possible because the
construction of the canonical pathname may require
filesystem queries
public java.lang.String getCanonicalPath()
throws java.io.IOException
getCanonicalPath in class GeneralFilejava.io.IOException - If an I/O error occurs, which is possible because the
construction of the canonical pathname may require
filesystem queriespublic java.lang.String getName()
getName in class GeneralFilepublic java.lang.String getParent()
getParent in class GeneralFilepublic GeneralFile getParentFile()
getParentFile in class GeneralFilenull if this pathname
does not name a parentpublic java.lang.String getPath()
getPath in class GeneralFilepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean isAbsolute()
isAbsolute in class GeneralFiletrue if this abstract pathname is absolute,
false otherwisepublic boolean isDirectory()
isDirectory in class GeneralFiletrue if and only if the file denoted by this
abstract pathname exists and is a directory;
false otherwisepublic boolean isFile()
isFile in class GeneralFiletrue if and only if the file denoted by this
abstract pathname exists and is a normal file;
false otherwisepublic boolean isHidden()
isHidden in class GeneralFiletrue if and only if the file denoted by this
abstract pathname is hidden.public long lastModified()
lastModified in class GeneralFilelong value representing the time the file was
last modified, measured in system-dependent way.public long length()
length in class GeneralFile0L if the file does not existpublic java.lang.String[] list()
list in class GeneralFilepublic java.lang.String[] list(java.io.FilenameFilter filter)
public GeneralFile[] listFiles()
listFiles in class GeneralFilepublic GeneralFile[] listFiles(java.io.FileFilter filter)
public GeneralFile[] listFiles(java.io.FilenameFilter filter)
public static GeneralFile[] listRoots()
public boolean mkdir()
mkdir in class GeneralFilepublic boolean mkdirs()
mkdirs in class GeneralFilepublic boolean renameTo(GeneralFile dest)
renameTo in class GeneralFiledest - The new abstract pathname for the named filepublic boolean setLastModified(long time)
setLastModified in class GeneralFiletime - The new last-modified time, measured in a
system-dependent way.public boolean setReadOnly()
setReadOnly in class GeneralFilepublic java.lang.String toString()
toString in class GeneralFilepublic java.net.URI toURI()
toURI in class GeneralFileGeneralFile.GeneralFile(java.net.URI),
URI,
URI.toURL()
public java.net.URL toURL()
throws java.net.MalformedURLException
toURL in class GeneralFilejava.net.MalformedURLException - If the path cannot be parsed as a URLGeneralFile.toURI(),
URI,
URI.toURL(),
URL
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||