SerializedType
- The type of object that can be serialized.public abstract class AbstractFileSerializationHandler<SerializedType> extends AbstractCloneableSerializable implements FileSerializationHandler<SerializedType>
FileSerializationHandler
. Takes care
of converting a file name to a File object.Constructor and Description |
---|
AbstractFileSerializationHandler()
Creates a new
AbstractFileSerializationHandler . |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
readFromFile(java.lang.String fileName)
Reads an object from the given file.
|
void |
writeToFile(java.lang.String fileName,
SerializedType object)
Writes an object to a given file.
|
clone
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
readFromFile, writeToFile
public AbstractFileSerializationHandler()
AbstractFileSerializationHandler
.public void writeToFile(java.lang.String fileName, SerializedType object) throws java.io.IOException
FileSerializationHandler
writeToFile
in interface FileSerializationHandler<SerializedType>
fileName
- The name of the file to write the object to.object
- The object to write.java.io.IOException
- If there is an i/o error.public java.lang.Object readFromFile(java.lang.String fileName) throws java.io.IOException, java.lang.ClassNotFoundException
FileSerializationHandler
readFromFile
in interface FileSerializationHandler<SerializedType>
fileName
- The name of the file to read an object from.java.io.IOException
- If there is an i/o error.java.lang.ClassNotFoundException
- If a class cannot be found.