|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.indiana.util.ObjectFileIO
public class ObjectFileIO
This class facilitates writing objects to files. Make sure that every object that is written (and its components) implement Serializable!
Constructor Summary | |
---|---|
ObjectFileIO(boolean showMessages)
Creates new ObjectFileIO |
Method Summary | |
---|---|
boolean |
beginReadObjectFromFile(java.lang.String filename)
Open a file and prepare it for reading objects. |
boolean |
beginWriteObjectToFile(java.lang.String filename)
Open a file and prepare it for writing objects. |
boolean |
endReadObjectFromFile()
Finish reading from the file opened with beginReadObjectFromFile(). |
boolean |
endWriteObjectToFile()
Finish writing to the file opened with beginWriteObjectToFile(). |
java.lang.Object |
readObject()
Read an object from the file opened with beginReadObjectFromFile(). |
static java.lang.Object |
readOneObjectFromFile(java.lang.String filename,
boolean showMessages)
Read a single object from a file, and return it. |
boolean |
writeObject(java.lang.Object o)
Write an object to the file opened with beginWriteObjectToFile(). |
static boolean |
writeOneObjectToFile(java.lang.Object obj,
java.lang.String filename,
boolean showMessages)
Write a single object to a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectFileIO(boolean showMessages)
Method Detail |
---|
public static java.lang.Object readOneObjectFromFile(java.lang.String filename, boolean showMessages)
filename
- The name of the file to be read.
public static boolean writeOneObjectToFile(java.lang.Object obj, java.lang.String filename, boolean showMessages)
obj
- The object to be written to the file.filename
- The file name of the file to be written.
public final boolean beginWriteObjectToFile(java.lang.String filename)
filename
- The name of the file that will be written.
public final boolean writeObject(java.lang.Object o)
o
- The object to write.
public final boolean endWriteObjectToFile()
public final boolean beginReadObjectFromFile(java.lang.String filename)
filename
- The name of the file that will be read.
public final java.lang.Object readObject()
o
- The object to read.
public final boolean endReadObjectFromFile()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |