|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectthings.common.tools.FileTools
public class FileTools
File manipulation utilities.
Version History
EPG - Initial - 24 NOV 04
Constructor Summary | |
---|---|
FileTools()
|
Method Summary | |
---|---|
static java.io.File |
appendFile(java.lang.String name)
Make a file. |
static void |
copy(java.io.File source,
java.io.File destination)
Copy a file. |
static void |
copy(java.io.InputStream source,
java.io.OutputStream destination)
Copy a stream. |
static void |
delete(java.io.File theFile)
Delete a file. |
static void |
destroy(java.io.File theFile)
Destroy a file or directory and all it's contents (including sub directories). |
static boolean |
detectRelativePath(java.lang.String path)
This will detect if the path has any relative pointers (such as ..). |
static java.lang.String |
loadFile2String(java.io.File path)
Read a file into a String. |
static int |
loadStream2Buffer(java.io.InputStream stream,
byte[] buffer)
Read a stream into a buffer, as much as can fit in the buffer, . |
static java.io.File |
makeFile(java.lang.String name)
Make a file. |
static void |
saveString2File(java.io.File path,
java.lang.String theString)
Save a string to a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileTools()
Method Detail |
---|
public static void copy(java.io.File source, java.io.File destination) throws java.lang.Throwable
source
- destination
-
java.lang.Throwable
public static void copy(java.io.InputStream source, java.io.OutputStream destination) throws java.lang.Throwable
source
- destination
-
java.lang.Throwable
public static void delete(java.io.File theFile) throws java.lang.Throwable
theFile
- the file. Null will be ignored.
java.lang.Throwable
public static void destroy(java.io.File theFile) throws java.lang.Throwable
theFile
- the file to destroy (it can be a real file or a directory).
java.lang.Throwable
public static java.io.File makeFile(java.lang.String name) throws java.lang.Throwable
name
- Path to the file
java.lang.Throwable
public static java.io.File appendFile(java.lang.String name) throws java.lang.Exception
name
- Path to the file
java.lang.Exception
public static boolean detectRelativePath(java.lang.String path)
path
- The path
public static java.lang.String loadFile2String(java.io.File path) throws java.io.IOException
path
- File to load
Certain
- IOException, like if the file cannot be found or opened.
java.io.IOException
public static int loadStream2Buffer(java.io.InputStream stream, byte[] buffer) throws java.io.IOException
stream
- the input streambuffer
- the buffer;
Certain
- IOException, like if the file cannot be found or opened.
java.io.IOException
public static void saveString2File(java.io.File path, java.lang.String theString) throws java.io.IOException
path
- File to savetheString
- the string.
Certain
- IOException, like if the file cannot be found or opened.
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |