org.terracotta.offheapstore.storage.portability
Interface Portability<T>

Type Parameters:
T - type handled by this converter
All Known Subinterfaces:
PersistentPortability<T>, WriteBackPortability<T>
All Known Implementing Classes:
BooleanPortability, ByteArrayPortability, PersistentByteArrayPortability, PersistentSerializablePortability, SerializablePortability, StringPortability

public interface Portability<T>

An object to ByteBuffer converter.

Author:
Chris Dennis

Method Summary
 T decode(ByteBuffer buffer)
          Decodes a ByteBuffer to an object of type T.
 ByteBuffer encode(T object)
          Encodes an object of type T as a ByteBuffer.
 boolean equals(Object object, ByteBuffer buffer)
          Returns true if the encoded object once decoded would be Object.equals(Object) to the supplied object.
 

Method Detail

encode

ByteBuffer encode(T object)
Encodes an object of type T as a ByteBuffer.

Parameters:
object - object to be encoded
Returns:
the encoded object

decode

T decode(ByteBuffer buffer)
Decodes a ByteBuffer to an object of type T.

Parameters:
buffer - bytes to decode
Returns:
the decoded object

equals

boolean equals(Object object,
               ByteBuffer buffer)
Returns true if the encoded object once decoded would be Object.equals(Object) to the supplied object.

Parameters:
object - object to compare to
buffer - buffer containing encoded object
Returns:
true if the two parameters are "equal"


Copyright © 2016. All rights reserved.