org.terracotta.offheapstore.storage.portability
Class SerializablePortability
java.lang.Object
org.terracotta.offheapstore.storage.portability.SerializablePortability
- All Implemented Interfaces:
- Portability<Serializable>
- Direct Known Subclasses:
- PersistentSerializablePortability
public class SerializablePortability
- extends Object
- implements Portability<Serializable>
A trivially compressed Java serialization based portability.
Class descriptors in the resultant bytes are encoded as integers. Mappings
between the integer representation and the ObjectStreamClass, and the
Class and the integer representation are stored in a single on-heap
map.
- Author:
- Chris Dennis
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
nextStreamIndex
protected int nextStreamIndex
lookup
protected final ConcurrentMap<Object,Object> lookup
SerializablePortability
public SerializablePortability()
SerializablePortability
public SerializablePortability(ClassLoader loader)
encode
public ByteBuffer encode(Serializable object)
- Description copied from interface:
Portability
- Encodes an object of type
T as a ByteBuffer.
- Specified by:
encode in interface Portability<Serializable>
- Parameters:
object - object to be encoded
- Returns:
- the encoded object
decode
public Serializable decode(ByteBuffer buffer)
- Description copied from interface:
Portability
- Decodes a
ByteBuffer to an object of type T.
- Specified by:
decode in interface Portability<Serializable>
- Parameters:
buffer - bytes to decode
- Returns:
- the decoded object
getObjectOutputStream
public ObjectOutputStream getObjectOutputStream(OutputStream out)
throws IOException
- Throws:
IOException
getObjectInputStream
public ObjectInputStream getObjectInputStream(InputStream input)
throws IOException
- Throws:
IOException
equals
public boolean equals(Object value,
ByteBuffer readBuffer)
- Description copied from interface:
Portability
- Returns true if the encoded object once decoded would be
Object.equals(Object) to the supplied object.
- Specified by:
equals in interface Portability<Serializable>
- Parameters:
value - object to compare toreadBuffer - buffer containing encoded object
- Returns:
true if the two parameters are "equal"
getOrAddMapping
protected int getOrAddMapping(ObjectStreamClass desc)
throws IOException
- Throws:
IOException
addedMapping
protected void addedMapping(Integer rep,
ObjectStreamClass disconnected)
disconnect
protected static ObjectStreamClass disconnect(ObjectStreamClass desc)
Copyright © 2016. All Rights Reserved.