|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.hunsicker.io.IoHelper
Some I/O helper routines.
Method Summary | |
static boolean |
delete(java.io.File file,
boolean recursive)
Deletes the given file or directory. |
static java.lang.Object |
deserialize(byte[] data)
Deserializes an object previously written using an ObjectOutputStream. |
static java.lang.Object |
deserialize(java.io.File file)
Deserializes the object stored in the given file. |
static java.lang.Object |
deserialize(java.io.InputStream in)
Deserializes the object stored in the given stream. |
static boolean |
ensureDirectoryExists(java.io.File directory)
Verifies the existence of the given directory and if that directory does not yet exist, tries to create it. |
static java.lang.String |
readTextFile(java.io.File file)
Returns the contents of the given text file. |
static void |
serialize(java.lang.Object o,
java.io.File file)
Serializes the given object to the given file. |
static void |
serialize(java.lang.Object o,
java.io.OutputStream out)
Serializes the given object to the given output stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static boolean delete(java.io.File file, boolean recursive)
file
- a file or directory.recursive
- if true
directories will be deleted recursively.
true
if the file or directory could be deleted successfully.public static java.lang.Object deserialize(byte[] data) throws java.io.IOException
data
- binary array.
java.io.IOException
- if an I/O error occured.serialize(java.lang.Object, java.io.OutputStream)
public static java.lang.Object deserialize(java.io.InputStream in) throws java.io.IOException
in
- an input stream.
java.io.IOException
- if an I/O exception occured.public static final java.lang.Object deserialize(java.io.File file) throws java.io.IOException
file
- a file.
java.io.IOException
- if an I/O exception occured.public static boolean ensureDirectoryExists(java.io.File directory)
directory
- directory to check for existence.
true
if the directory already exists or was successfully
created.
java.lang.IllegalArgumentException
- if directory does exist but does not
denote a valid directory.public static java.lang.String readTextFile(java.io.File file) throws java.io.IOException
file
- text file to be read.
java.io.IOException
- if an I/O error occured.public static void serialize(java.lang.Object o, java.io.OutputStream out) throws java.io.IOException
o
- a serializable object.out
- the stream to write the object to.
java.io.IOException
- if an I/O exception occured.public static void serialize(java.lang.Object o, java.io.File file) throws java.io.IOException
o
- a serializable object.file
- the file to write the object to.
java.io.IOException
- if an I/O exception occured.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |