Package ratpack.session
Interface SessionSerializer
-
- All Known Subinterfaces:
JavaSessionSerializer
public interface SessionSerializerA serializer converts objects to bytes and vice versa.The
SessionModuleprovides a default implementation that uses Java's in built serialization.- See Also:
JavaSessionSerializer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Tdeserialize(java.lang.Class<T> type, java.io.InputStream in)Reads the bytes of the given input stream, creating a new object.<T> voidserialize(java.lang.Class<T> type, T value, java.io.OutputStream out)Writes the given value to the output stream as bytes.
-
-
-
Method Detail
-
serialize
<T> void serialize(java.lang.Class<T> type, T value, java.io.OutputStream out) throws java.lang.ExceptionWrites the given value to the output stream as bytes.- Type Parameters:
T- the type of the object- Parameters:
type- the declared type of the objectvalue- the value to serializeout- the destination for the bytes- Throws:
java.lang.Exception- if the value could not be serialized
-
deserialize
<T> T deserialize(java.lang.Class<T> type, java.io.InputStream in) throws java.lang.ExceptionReads the bytes of the given input stream, creating a new object.- Type Parameters:
T- the type of the object- Parameters:
type- the expected type of the objectin- the source of the bytes- Returns:
- the object
- Throws:
java.io.IOException- any thrown byinjava.lang.Exception- the the value could not be deserialized
-
-