|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.misc.FileUtil
Utilities for manipulations of disk files
| Constructor Summary | |
FileUtil()
Constructor |
|
| Method Summary | |
static void |
cleanDirs(String fileName)
CleanDirs is a utility method for cleaning up temporary directories, used by various methods to hold & process files on the file system. |
static void |
copyFile(String sourceFile,
String destFile)
Utility method to copy a file from one place to another & delete the original. |
static void |
copyStream(InputStream is,
OutputStream os)
CopyStream does just what it says: It copies the entire contents of the input stream to the output stream by using reading and writing in 4k chunks. |
static String |
getBase(String fileName)
Get the base filename of a file (e.g. no directory or extension) |
static Vector |
getDir(String dirName)
Return a vector of the file/dir names in any give directory |
static String |
getExtension(String fileName)
Get the file extension (after the ".") |
static Vector |
getFileListingRecursive(String dirName,
String prefix,
String separator,
Vector includeExtension)
Return a vector of the recursive listing of the file names starting from in any given directory |
static String |
getPath(String fileName)
Get the path of a file name |
static File |
getTempDirectory(String dataContext)
Retrieve the temp directory in the form of a java.io.File object. |
static void |
main(String[] args)
Command line interface to run specific items [Also used for unit testing] |
static String |
makeAbsolutePath(String prefix,
String originalPath)
Take a prefix and a relative path and put the two together to make an absolute path |
static void |
moveFile(String sourceFile,
String destFile)
Copy a file, then remove the original file |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FileUtil()
| Method Detail |
public static File getTempDirectory(String dataContext)
throws ConfigurationException
dataContext - the location to look for the setup table
ConfigurationException - if the specified data context cannot be
foundpublic static String getBase(String fileName)
fileName - Original pathname to get the base name from. IMPORTANT:
This method assumes that "/" is the directory seperator, not
"\"!!!
public static Vector getDir(String dirName)
throws IOException
dirName - the name of the directory to retrieve a list of all files
IOException - If the given name is not a directory or if an I/O
error occurs when trying to read the file list
public static Vector getFileListingRecursive(String dirName,
String prefix,
String separator,
Vector includeExtension)
throws IOException
dirName - the name of the directory to retrieve a list of all files in that directory and it's sub-directoriesprefix - a string to prepend to the pathincludeExtension - List of strings of files to be included. All are included if the list is null.
IOException - If the given dirName is not a directory or if an I/O
error occurs when trying to read the file listpublic static String getExtension(String fileName)
fileName - Original full file name
public static String getPath(String fileName)
fileName - Original pathname
public static void cleanDirs(String fileName)
throws IOException
fileName - the name of the directory to clean
IOException - upon error
public static void copyFile(String sourceFile,
String destFile)
throws IOException
sourceFile - Source file pathnamedestFile - Destination file pathname
IOException - If the copy fails due to an I/O errorpublic static void main(String[] args)
args - the command line arguments
public static String makeAbsolutePath(String prefix,
String originalPath)
prefix - the prefix of the pathoriginalPath - the original pathname
public static void moveFile(String sourceFile,
String destFile)
throws IOException
sourceFile - Original file namedestFile - Destination file name
IOException - If an I/O error occurs during the copy
public static void copyStream(InputStream is,
OutputStream os)
throws IOException
is - the input stream for the source of the copyos - the output stream for the sink of the copy
IOException - upon error
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||