Package org.apache.shiro.lang.io
Class DefaultSerializer<T>
java.lang.Object
org.apache.shiro.lang.io.DefaultSerializer<T>
- All Implemented Interfaces:
Serializer<T>
Serializer implementation that uses the default JVM serialization mechanism (Object Input/Output Streams).
- Since:
- 0.9
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(byte[] serialized) This implementation deserializes the byte array using aObjectInputStreamusing a sourceByteArrayInputStreamconstructed with the argument byte array.byte[]This implementation serializes the Object by using anObjectOutputStreambacked by aByteArrayOutputStream.
-
Constructor Details
-
DefaultSerializer
public DefaultSerializer()
-
-
Method Details
-
serialize
This implementation serializes the Object by using anObjectOutputStreambacked by aByteArrayOutputStream. TheByteArrayOutputStream's backing byte array is returned.- Specified by:
serializein interfaceSerializer<T>- Parameters:
o- the Object to convert into a byte[] array.- Returns:
- the bytes representing the serialized object using standard JVM serialization.
- Throws:
SerializationException- wrapping aIOExceptionif something goes wrong with the streams.
-
deserialize
This implementation deserializes the byte array using aObjectInputStreamusing a sourceByteArrayInputStreamconstructed with the argument byte array.- Specified by:
deserializein interfaceSerializer<T>- Parameters:
serialized- the raw data resulting from a previousserializecall.- Returns:
- the deserialized/reconstituted object based on the given byte array
- Throws:
SerializationException- if anything goes wrong using the streams.
-