|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.util.FileUtil
public class FileUtil
General helper methods for messing with files
Constructor Summary | |
---|---|
FileUtil()
|
Method Summary | |
---|---|
static boolean |
copy(java.lang.String source,
java.lang.String dest,
boolean overwriteExisting)
return true if it was copied successfully |
static boolean |
extractZip(java.io.File zipfile,
java.io.File targetDir)
|
static void |
main(java.lang.String[] args)
Usage: FileUtil (delete path | copy source dest) |
static void |
readFile(java.lang.String path,
java.lang.String root,
java.io.OutputStream out)
Dump the contents of the given path (relative to the root) to the output stream. |
static java.lang.String |
readTextFile(java.lang.String filename,
int maxNumLines,
boolean startAtBeginning)
Read in the last few lines of a (newline delimited) textfile, or null if the file doesn't exist. |
static boolean |
rmdir(java.io.File target,
boolean failIfNotEmpty)
Delete the path as well as any files or directories underneath it. |
static boolean |
rmdir(java.lang.String path,
boolean failIfNotEmpty)
Delete the path as well as any files or directories underneath it. |
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 final boolean rmdir(java.lang.String path, boolean failIfNotEmpty)
path
- path to the directory being deletedfailIfNotEmpty
- if true, do not delete anything if the directory
is not empty (and return false)
public static final boolean rmdir(java.io.File target, boolean failIfNotEmpty)
target
- the file or directory being deletedfailIfNotEmpty
- if true, do not delete anything if the directory
is not empty (and return false)
public static boolean extractZip(java.io.File zipfile, java.io.File targetDir)
public static java.lang.String readTextFile(java.lang.String filename, int maxNumLines, boolean startAtBeginning)
startAtBeginning
- if true, read the first maxNumLines, otherwise read
the last maxNumLinesmaxNumLines
- max number of lines (or -1 for unlimited)public static void readFile(java.lang.String path, java.lang.String root, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public static boolean copy(java.lang.String source, java.lang.String dest, boolean overwriteExisting)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |