org.terracotta.cache.serialization
Interface SerializationStrategy<T>

Type Parameters:
T - value type
All Known Subinterfaces:
SerializationStrategy2<T>, SerializationStrategy3<T>
All Known Implementing Classes:
DsoSerializationStrategy, DsoSerializationStrategy2, DsoSerializationStrategy3, NonDsoSerializationStrategy

public interface SerializationStrategy<T>

A cache key/value serialization strategy.

Implementation of this class are used to convert cache keys and values into detached representations that are portable across the cluster.


Method Summary
 T deserialize(byte[] data)
          Deserialize the serialized value returning a new representation.
 T deserialize(byte[] data, ClassLoader loader)
          Deserialize the serialized value using the specified loader, and returning a new representation.
 String generateStringKeyFor(Object key)
          Convert the given key into a portable String form.
 byte[] serialize(T value)
          Serialize the given value into a detached, portable form.
 

Method Detail

deserialize

T deserialize(byte[] data)
              throws IOException,
                     ClassNotFoundException
Deserialize the serialized value returning a new representation.

Parameters:
data - serialized form
Returns:
a new deserialized value
Throws:
IOException - if deserialization fails
ClassNotFoundException - if a required class is not found

deserialize

T deserialize(byte[] data,
              ClassLoader loader)
              throws IOException,
                     ClassNotFoundException
Deserialize the serialized value using the specified loader, and returning a new representation.

Parameters:
data - serialized form
loader - to use during deserialization
Returns:
a new deserialized value
Throws:
IOException - if deserialization fails
ClassNotFoundException - if a required class is not found

serialize

byte[] serialize(T value)
                 throws IOException
Serialize the given value into a detached, portable form.

Parameters:
value - value to serialize
Returns:
serialized form
Throws:
IOException - if serialization fails

generateStringKeyFor

String generateStringKeyFor(Object key)
                            throws IOException
Convert the given key into a portable String form.

Parameters:
key - key to serialize
Returns:
a portable String key
Throws:
IOException - if serialization fails


Copyright © 2015 Terracotta, Inc.. All Rights Reserved.