SerializedType
- The type of object that can be serialized.public abstract class AbstractTextSerializationHandler<SerializedType> extends AbstractStreamSerializationHandler<SerializedType> implements TextSerializationHandler<SerializedType>
TextSerializationHandler
interface.
Converts stream calls to readers/writers so all you need to implement are
those versions of the methods.Constructor and Description |
---|
AbstractTextSerializationHandler()
Creates a new
AbstractTextSerializationHandler . |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
convertFromString(java.lang.String string)
Converts an object from its serialized string representation.
|
java.lang.String |
convertToString(SerializedType object)
Converts a given object to its serialized string representation.
|
java.lang.Object |
readObject(java.io.InputStream stream)
Reads an object from the given stream.
|
void |
writeObject(java.io.OutputStream stream,
SerializedType object)
Writes an object to a given output stream.
|
convertFromBytes, convertToBytes, readFromFile, writeToFile
readFromFile, writeToFile
clone
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
readObject, writeObject
convertFromBytes, convertToBytes
readFromFile, readFromFile, writeToFile, writeToFile
public AbstractTextSerializationHandler()
AbstractTextSerializationHandler
.public void writeObject(java.io.OutputStream stream, SerializedType object) throws java.io.IOException
StreamSerializationHandler
writeObject
in interface StreamSerializationHandler<SerializedType>
stream
- The stream to write the object to.object
- The object to write.java.io.IOException
- If there is an i/o error.public java.lang.Object readObject(java.io.InputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
StreamSerializationHandler
readObject
in interface StreamSerializationHandler<SerializedType>
stream
- The stream 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 java.lang.String convertToString(SerializedType object) throws java.io.IOException
TextSerializationHandler
convertToString
in interface TextSerializationHandler<SerializedType>
object
- The object to serialized to a string.java.io.IOException
- If there is an i/o error.public java.lang.Object convertFromString(java.lang.String string) throws java.io.IOException, java.lang.ClassNotFoundException
TextSerializationHandler
convertFromString
in interface TextSerializationHandler<SerializedType>
string
- The string to convert an object from.java.io.IOException
- If there is an i/o error.java.lang.ClassNotFoundException
- If a class cannot be found.