|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.rhq.core.pluginapi.util.FileUtils
public abstract class FileUtils
A set of utilities for working with files and file paths.
Method Summary | |
---|---|
static String |
findString(String filePath,
String stringToFind)
|
static String |
getCanonicalPath(String path)
Canonicalize the specified file path according to the current platform's rules: Condense multiple consecutive path separators into a single path separator. |
static void |
purge(File fileOrDir,
boolean deleteIt)
The purpose of this method is to purge a directory of all of its contents, but it can also be used to simply delete a given file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void purge(File fileOrDir, boolean deleteIt) throws IOException
dir
is a directory, this method will
attempt to delete all of its files and all of its subdirectories and their child files/subdirectories.
dir
itself will then be deleted, but only if deleteIt
is true
.
If dir
is not a directory, but rather a simple file, it will be deleted only if
deleteIt
is true
.
Note - This method does not protect against symbolic links and will follow them on UNIX/Linux.
If dir
is null
, this method does nothing.
fileOrDir
- the file or directory to purgedeleteIt
- if true
, dir
will be deleted after all of its contents are
deleted
IOException
- if the purge failspublic static String findString(String filePath, String stringToFind) throws IOException
IOException
public static String getCanonicalPath(String path)
File.getCanonicalPath()
, this method does not resolve symlinks.
The path may or may not reference an existing file.
path
- the file path to be canonicalized
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |