SerializedType - The type of object that can be serialized.public abstract class AbstractStreamSerializationHandler<SerializedType> extends AbstractFileSerializationHandler<SerializedType> implements StreamSerializationHandler<SerializedType>
StreamSerializationHandler. Handles
the file and byte reading aspects so all you need to implement is the write
and read methods.| Constructor and Description |
|---|
AbstractStreamSerializationHandler()
Creates a new
AbstractStreamSerializationHandler. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
convertFromBytes(byte[] bytes)
Converts the first given object in the given byte array.
|
byte[] |
convertToBytes(SerializedType object)
Converts the given object to bytes.
|
java.lang.Object |
readFromFile(java.io.File file)
Reads an object from the given file.
|
void |
writeToFile(java.io.File file,
SerializedType object)
Reads an object from a given file.
|
readFromFile, writeToFilecloneequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreadObject, writeObjectreadFromFile, writeToFilepublic AbstractStreamSerializationHandler()
AbstractStreamSerializationHandler.public void writeToFile(java.io.File file,
SerializedType object)
throws java.io.IOException
FileSerializationHandlerwriteToFile in interface FileSerializationHandler<SerializedType>file - 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.io.File file)
throws java.io.IOException,
java.lang.ClassNotFoundException
FileSerializationHandlerreadFromFile in interface FileSerializationHandler<SerializedType>file - 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.public byte[] convertToBytes(SerializedType object) throws java.io.IOException
StreamSerializationHandlerconvertToBytes in interface StreamSerializationHandler<SerializedType>object - The object to convert to bytes.java.io.IOException - If there is an i/o error.public java.lang.Object convertFromBytes(byte[] bytes)
throws java.io.IOException,
java.lang.ClassNotFoundException
StreamSerializationHandlerconvertFromBytes in interface StreamSerializationHandler<SerializedType>bytes - The bytes to convert the object from.java.io.IOException - If there is an i/o error.java.lang.ClassNotFoundException - If a class cannot be found.