|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openbp.common.io.FileUtil
public final class FileUtil
The FileUtil class provides some additional static file management utility methods not contained in java.io.File. The class contains static method only.
| Field Summary | |
|---|---|
static int |
FILETYPE_ANY
File type 'any file' (argument for list(java.lang.String, java.lang.String, int)) |
static int |
FILETYPE_DIR
File type 'directory' (argument for list(java.lang.String, java.lang.String, int)) |
static int |
FILETYPE_FILE
File type 'file' (argument for list(java.lang.String, java.lang.String, int)) |
| Method Summary | |
|---|---|
static void |
copy(java.io.File src,
java.io.File dest)
Copy a file or directory. |
static void |
copy(java.io.File src,
java.io.File dest,
java.io.FilenameFilter filter)
Copy a file or directory using a file name filter. |
static java.io.File |
getParent(java.io.File f,
boolean returnCurrent)
File.getParent() can return null when the file is specified without a directory or is in the root directory. |
static java.lang.String[] |
list(java.lang.String dirName,
java.lang.String pattern,
int fileType)
Returns an array of strings naming the files and directories in a directory, matching the files against an optional pattern and file type. |
static void |
remove(java.io.File src)
Recursively removes a file or directory. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int FILETYPE_ANY
list(java.lang.String, java.lang.String, int))
public static final int FILETYPE_FILE
list(java.lang.String, java.lang.String, int))
public static final int FILETYPE_DIR
list(java.lang.String, java.lang.String, int))
| Method Detail |
|---|
public static java.lang.String[] list(java.lang.String dirName,
java.lang.String pattern,
int fileType)
dirName - Name of the directory or null for the current directorypattern - Wildcard pattern (see the ShellMatcher class)fileType - Type of file to be listed (FILETYPE_ANY/FILETYPE_FILE/FILETYPE_DIR)
KNOWN BUG: It seems that on Win32 systems, it does always return
all files and directories matching pattern, regardless of fileType.
java.lang.SecurityException - If a security manager exists and denies read access to the directory
public static void remove(java.io.File src)
throws java.io.IOException
src - File or directory to delete
java.io.IOException - If the file could not be deleted
public static void copy(java.io.File src,
java.io.File dest)
throws java.io.IOException
src - Source file or directorydest - Destination file or directory
java.io.IOException - If the operation fails
public static void copy(java.io.File src,
java.io.File dest,
java.io.FilenameFilter filter)
throws java.io.IOException
src - Source file or directorydest - Destination file or directoryfilter - File name filter that determines which files of a directory will be copied
java.io.IOException - If the operation fails
public static java.io.File getParent(java.io.File f,
boolean returnCurrent)
f - The target File to analyzereturnCurrent - true Returns a file object (the current directory) also if the file does not
contain a path specification.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||