Package ratpack.session
Interface SessionSerializer
-
- All Known Subinterfaces:
JavaSessionSerializer
public interface SessionSerializer
A serializer converts objects to bytes and vice versa.The
SessionModule
provides 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> T
deserialize(java.lang.Class<T> type, java.io.InputStream in)
Reads the bytes of the given input stream, creating a new object.<T> void
serialize(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.Exception
Writes 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.Exception
Reads 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 byin
java.lang.Exception
- the the value could not be deserialized
-
-