|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.any23.util.FileUtils
public class FileUtils
Utility class for handling files.
| Method Summary | |
|---|---|
static void |
cp(File src,
File dest)
Copies a file src to the dest. |
static void |
cp(InputStream is,
File dest)
Copies the content of the input stream within the given dest file. |
static void |
dumpContent(File f,
String content)
Dumps the given string within a file. |
static void |
dumpContent(File f,
Throwable t)
Dumps the stack trace of the given exception into the specified file. |
static File[] |
listFilesRecursively(File dir,
FilenameFilter filenameFilter)
Lists the content of a dir applying the specified filter. |
static File |
mv(File target,
File dest)
Moves a target file to a new dest location. |
static String |
readFileContent(File f)
Returns the content of a file a single string. |
static String[] |
readFileLines(File f)
Returns all the lines of a file. |
static String |
readResourceContent(Class clazz,
String resource)
Reads a resource file and returns the content as a string. |
static String |
readResourceContent(String resource)
Reads a resource file and returns the content as a string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static File mv(File target,
File dest)
target file to a new dest location.
target - file to be moved.dest - dest dir.
public static void cp(InputStream is,
File dest)
is - dest -
public static void cp(File src,
File dest)
throws FileNotFoundException
src to the dest.
src - source file.dest - destination file.
FileNotFoundException - if file cannot be copied or created.
public static void dumpContent(File f,
String content)
throws IOException
f - file target.content - content to be dumped.
IOException
public static void dumpContent(File f,
Throwable t)
throws IOException
f - file to generate dump.t - exception to be dumped.
IOException
public static String readResourceContent(Class clazz,
String resource)
throws IOException
clazz - the class to use load the resource.resource - the resource to be load.
IOException
public static String readResourceContent(String resource)
throws IOException
resource - the resource to be load.
IOException
public static String readFileContent(File f)
throws IOException
f - the file to read.
IOException - if an error occurs while locating or accessing the file.
public static String[] readFileLines(File f)
throws IOException
f - the file to read.
null array with not null line strings.
IOException - if an error occurs while locating or accessing the file.
public static File[] listFilesRecursively(File dir,
FilenameFilter filenameFilter)
dir - directory root.filenameFilter - filter to be applied.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||