|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cc.mallet.util.FileUtils
public class FileUtils
Contains static utilities for manipulating files. Created: Thu Nov 20 15:14:16 2003
Method Summary | |
---|---|
static java.lang.String[] |
readFile(java.io.File f)
Reads every line from a given text file. |
static java.lang.Object |
readGzippedObject(java.io.File f)
Reads a serialized object from a file that has been compressed using gzip. |
static java.lang.Object |
readObject(java.io.File f)
Reads a Serialized object, which may or may not be zipped. |
static java.lang.Object |
readUnzippedObject(java.io.File f)
Reads a serialized object from a file. |
static java.io.File |
uniqueFile(java.io.File dir,
java.lang.String prefix,
java.lang.String extension)
Creates a file, making sure that its name is unique. |
static void |
writeGzippedObject(java.io.File f,
java.io.Serializable obj)
Writes a serialized version of obj to a given file, compressing it using gzip. |
static void |
writeObject(java.io.File f,
java.io.Serializable obj)
Serializes an object to a file, masking out annoying exceptions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void writeObject(java.io.File f, java.io.Serializable obj)
writeGzippedObject(java.io.File, java.io.Serializable)
instead, for that method will compress the serialized file, and it'll still
be reaoable by readObject(java.io.File)
.
f
- File to write toobj
- Object to serializewriteGzippedObject(java.io.File, java.io.Serializable)
public static java.lang.Object readObject(java.io.File f)
f
- File to read data from
public static java.lang.Object readUnzippedObject(java.io.File f)
readObject(java.io.File)
instead, because that method will automatically guess
from the extension whether the file is compressed, and call this method if necessary.
f
- File to read object fromreadObject(java.io.File)
public static java.lang.String[] readFile(java.io.File f) throws java.io.IOException
f
- Input file.
f
.
java.io.IOException
public static java.io.File uniqueFile(java.io.File dir, java.lang.String prefix, java.lang.String extension) throws java.io.IOException
dir
- Directory to use for the returned fileprefix
- Prefix of the file name (before the uniquifying integer)extension
- Suffix of the file name (after the uniquifying integer)
java.io.IOException
public static void writeGzippedObject(java.io.File f, java.io.Serializable obj)
f
- File to write toobj
- Object to serializepublic static java.lang.Object readGzippedObject(java.io.File f)
readObject(java.io.File)
instead, because it will automatically guess
from the extension whether the file is compressed, and call this method if necessary.
f
- Compressed file to read object fromreadObject(java.io.File)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |