public class SerializablePortability extends Object implements Portability<Serializable>
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.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
SerializablePortability.SerializableDataKey |
| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentMap<Object,Object> |
lookup |
protected int |
nextStreamIndex |
| Constructor and Description |
|---|
SerializablePortability() |
SerializablePortability(ClassLoader loader) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addedMapping(Integer rep,
ObjectStreamClass disconnected) |
Serializable |
decode(ByteBuffer buffer)
Decodes a
ByteBuffer to an object of type T. |
protected static ObjectStreamClass |
disconnect(ObjectStreamClass desc) |
ByteBuffer |
encode(Serializable object)
Encodes an object of type
T as a ByteBuffer. |
boolean |
equals(Object value,
ByteBuffer readBuffer)
Returns true if the encoded object once decoded would be
Object.equals(Object) to the supplied object. |
ObjectInputStream |
getObjectInputStream(InputStream input) |
ObjectOutputStream |
getObjectOutputStream(OutputStream out) |
protected int |
getOrAddMapping(ObjectStreamClass desc) |
protected int nextStreamIndex
protected final ConcurrentMap<Object,Object> lookup
public SerializablePortability()
public SerializablePortability(ClassLoader loader)
public ByteBuffer encode(Serializable object)
PortabilityT as a ByteBuffer.encode in interface Portability<Serializable>object - object to be encodedpublic Serializable decode(ByteBuffer buffer)
PortabilityByteBuffer to an object of type T.decode in interface Portability<Serializable>buffer - bytes to decodepublic ObjectOutputStream getObjectOutputStream(OutputStream out) throws IOException
IOExceptionpublic ObjectInputStream getObjectInputStream(InputStream input) throws IOException
IOExceptionpublic boolean equals(Object value, ByteBuffer readBuffer)
PortabilityObject.equals(Object) to the supplied object.equals in interface Portability<Serializable>value - object to compare toreadBuffer - buffer containing encoded objecttrue if the two parameters are "equal"protected int getOrAddMapping(ObjectStreamClass desc) throws IOException
IOExceptionprotected void addedMapping(Integer rep, ObjectStreamClass disconnected)
protected static ObjectStreamClass disconnect(ObjectStreamClass desc)
Copyright © 2015–2024. All rights reserved.