JSecurity

org.jsecurity.io
Interface Serializer

All Known Implementing Classes:
DefaultSerializer, XmlSerializer

public interface Serializer

A Serializer converts objects to raw binary data and vice versa, enabling persistent storage of objects to files, HTTP cookies, or other mechanism.

A Serializer should only do conversion, never change the data, such as encoding/decoding or encryption. These orthoganal concerns are handled elsewhere by JSecurity, for example, via CodecSupport and Ciphers.

Since:
0.9
Author:
Les Hazlewood

Method Summary
 Object deserialize(byte[] serialized)
          Converts the specified raw byte[] array back into an original Object form.
 byte[] serialize(Object o)
          Converts the specified Object into a byte[] array.
 

Method Detail

serialize

byte[] serialize(Object o)
                 throws SerializationException
Converts the specified Object into a byte[] array. This byte[] array must be able to be reconstructed back into the original Object form via the deserialize method.

Parameters:
o - the Object to convert into a byte[] array.
Returns:
a byte[] array representing the Object's state that can be restored later.
Throws:
SerializationException - if an error occurrs converting the Object into a byte[] array.

deserialize

Object deserialize(byte[] serialized)
                   throws SerializationException
Converts the specified raw byte[] array back into an original Object form. This byte[] array is expected to be the output of a previous serialize method call.

Parameters:
serialized - the raw data resulting from a previous serialize call.
Returns:
the Object that was previously serialized into the raw byte[] array.
Throws:
SerializationException - if an error occurrs converting the raw byte[] array back into an Object.

JSecurity

Copyright © 2004-2008 JSecurity.