|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--amber.utility.FileHandler
| Constructor Summary | |
FileHandler()
Default constructor. |
|
FileHandler(java.io.File initialDirectory)
Construct the FileHandler object pointing to a specified base directory. |
|
FileHandler(java.lang.String initialDirectory)
Construct the FileHandler object pointing to a specified base directory. |
|
| Method Summary | |
void |
cd(java.lang.String destination)
Changes the current directory to the specified directory. |
static java.lang.String |
createCompositeFilename(java.lang.String directory,
java.lang.String name)
This function creates a composite filename given a directory and filename. |
void |
delete(java.lang.String filename)
Deletes the specified file or directory in the current directory. |
void |
deleteDirectory(java.lang.String baseDirectory,
boolean deleteDirectory)
Deletes the specified directory. |
void |
deleteDirectoryStructure(java.io.File baseDirectory,
boolean deleteDirectory)
Deletes the specified directory. |
java.lang.String[] |
dir()
Returns the files in the current directory. |
java.lang.String[] |
dir(java.io.FilenameFilter criteria)
Returns the matching files in the current directory. |
java.lang.String[] |
dir(java.lang.String directory)
Returns the files in the current directory. |
java.lang.String[] |
dir(java.lang.String directory,
java.io.FilenameFilter criteria)
Returns the files in the current directory. |
java.lang.String[] |
dirDirectories()
Returns only the directories in the current directory. |
java.lang.String[] |
dirFiles()
Returns only the files in the current directory. |
java.io.File |
getCurrentDirectory()
Returns the current directory of this object. |
java.io.File |
getParent()
Returns the parent directory of the current directory. |
static java.io.File |
getParent(java.io.File child)
Returns the parent directory of the input directory. |
static java.io.File |
getRelativeDirectory(java.io.File startingDirectory,
java.lang.String relativeDirectory)
This function returns the directory specified in the relativeDirectory argument relative to the directory specified in start. |
static java.io.File |
getRelativeFile(java.io.File startingDirectory,
java.lang.String relativeFile)
This function returns the directory specified in the relativeDirectory argument relative to the directory specified in start. |
static java.io.File |
getRelativeFile(java.io.File startingDirectory,
java.lang.String relativeFile,
boolean mustExist)
This function returns the directory specified in the relativeDirectory argument relative to the directory specified in start. |
void |
makeDirectory(java.lang.String directory)
Creates the specified directory in the current directory. |
void |
makeDirectoryTree(java.lang.String directory)
Creates the specified directory in the current directory. |
static java.lang.String |
removeTrailingSeparator(java.lang.String dir)
This function removes trailing file separator characters to ensure that the directory ends without them. |
void |
rename(java.lang.String oldFilename,
java.lang.String newFilename)
Renames the specified file in the current directory. |
void |
setCurrentDirectory(java.io.File directory)
Sets the current directory of this object. |
void |
setCurrentDirectory(java.lang.String directory)
Sets the current directory of this object. |
void |
up()
This changes the current directory up one directory. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FileHandler()
public FileHandler(java.io.File initialDirectory)
throws java.io.IOException
initialDirectory - File containing the initial directory.java.io.IOException - containing errors connecting to the
specified directory.
public FileHandler(java.lang.String initialDirectory)
throws java.io.IOException
initialDirectory - String containing the initial directory.java.io.IOException - containing errors connecting to the
specified directory.| Method Detail |
public static java.lang.String createCompositeFilename(java.lang.String directory,
java.lang.String name)
directory - String containing the directory name.filename - String filename.public static java.lang.String removeTrailingSeparator(java.lang.String dir)
dir - String directory to truncate.
public void setCurrentDirectory(java.lang.String directory)
throws java.io.IOException
directory - String containing the current directory.java.io.IOException - containing errors in making the directory
change.public void setCurrentDirectory(java.io.File directory)
directory - File containing the current directory.public java.io.File getCurrentDirectory()
public static java.io.File getRelativeDirectory(java.io.File startingDirectory,
java.lang.String relativeDirectory)
throws java.io.IOException
startingDirectory - File containing the directory to start at.relativeDirectory - String containing the path of the new
directory relative to the startingDirectory.java.io.IOException - containing errors in making the directory
change.
public static java.io.File getRelativeFile(java.io.File startingDirectory,
java.lang.String relativeFile)
throws java.io.IOException
startingDirectory - File containing the directory to start at.relativeFile - String containing the path of the new
file/directory relative to the startingDirectory.java.io.IOException - containing errors in making the directory
change.
public static java.io.File getRelativeFile(java.io.File startingDirectory,
java.lang.String relativeFile,
boolean mustExist)
throws java.io.IOException
startingDirectory - File containing the directory to start at.relativeFile - String containing the path of the new
file/directory relative to the startingDirectory.mustExist - boolean when true the file must exist.java.io.IOException - containing errors in making the directory
change.
public static java.io.File getParent(java.io.File child)
throws java.io.IOException
child - File containing the object to get the parent of.java.io.IOException - containing errors in making the directory
change.
public java.io.File getParent()
throws java.io.IOException
java.io.IOException - containing errors in making the directory
change.
public void up()
throws java.io.IOException
java.io.IOException - containing errors in making the directory
change.
public void cd(java.lang.String destination)
throws java.io.IOException
destination - String directory to change to.java.io.IOException - containing errors in making the directory
change.public java.lang.String[] dir()
public java.lang.String[] dirFiles()
public java.lang.String[] dirDirectories()
public java.lang.String[] dir(java.io.FilenameFilter criteria)
criteria - FilenameFilter which is used to define which files
are of interest.
public java.lang.String[] dir(java.lang.String directory)
throws java.io.IOException
directory - String containing the directory to list.java.io.IOException - containing errors in making the directory
change.
public java.lang.String[] dir(java.lang.String directory,
java.io.FilenameFilter criteria)
throws java.io.IOException
directory - String containing the directory to list.criteria - FilenameFilter which is used to define which files
are of interest.java.io.IOException - containing errors in making the directory
change.
public void makeDirectory(java.lang.String directory)
throws java.io.IOException
directory - String containing the directory to create.java.io.IOException - containing errors in making the directory.
public void makeDirectoryTree(java.lang.String directory)
throws java.io.IOException
directory - String containing the directory to create.java.io.IOException - containing errors in making the directory.
public void rename(java.lang.String oldFilename,
java.lang.String newFilename)
throws java.io.IOException
oldFilename - String name of the file to rename.newFilename - String new name of the file.java.io.IOException - containing errors in making the file name
change.
public void delete(java.lang.String filename)
throws java.io.IOException
filename - String name of the file to delete.java.io.IOException - containing errors in making the file name
change.
public void deleteDirectory(java.lang.String baseDirectory,
boolean deleteDirectory)
throws java.io.IOException
baseDirectory - String name of the directory to delete.deleteDirectory - If this flag is true then the base directory
is deleted also. If the flag is false then all children are deleted but
the base directory will be left intact.java.io.IOException - containing errors in making the file name
change.
public void deleteDirectoryStructure(java.io.File baseDirectory,
boolean deleteDirectory)
throws java.io.IOException
baseDirectory - File directory to delete.deleteDirectory - If this flag is true then the base directory
is deleted also. If the flag is false then all children are deleted but
the base directory will be left intact.java.io.IOException - containing errors in making the file name
change.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||