public class DefaultSerializer<T> extends Objectimplements Serializer <T>
| Constructor and Description |
|---|
DefaultSerializer()
|
| Modifier and Type | Method and Description |
|---|---|
T |
deserialize(byte[] serialized)
This implementation deserializes the byte array using a
ObjectInputStream using a source
ByteArrayInputStream constructed with the argument byte array.
|
byte[] |
serialize(T o)
This implementation serializes the Object by using an
ObjectOutputStream backed by a
ByteArrayOutputStream.
|
public byte[] serialize(T o) throws SerializationException
ObjectOutputStream backed by a
ByteArrayOutputStream. The
ByteArrayOutputStream's backing byte array is returned.
serialize in interface
Serializer<T>
o - the Object to convert into a byte[] array.
SerializationException - wrapping a
IOException if something goes wrong with the streams.
public T deserialize(byte[] serialized) throws SerializationException
ObjectInputStream using a source
ByteArrayInputStream constructed with the argument byte array.
deserialize in interface
Serializer<T>
serialized - the raw data resulting from a previous
serialize call.
SerializationException - if anything goes wrong using the streams.