org.simantics.databoard.serialization
Class BinarySerializationFormat.GenericUnionSerializer
java.lang.Object
org.simantics.databoard.serialization.Serializer
org.simantics.databoard.serialization.Serializer.CompositeSerializer
org.simantics.databoard.serialization.BinarySerializationFormat.GenericUnionSerializer
- Enclosing class:
- BinarySerializationFormat
public static class BinarySerializationFormat.GenericUnionSerializer
- extends Serializer.CompositeSerializer
Method Summary |
java.lang.Object |
deserialize(BinaryReadable in,
java.util.List<java.lang.Object> identities)
Deserialize an object from a readable. |
java.lang.Integer |
getConstantSize()
Get constant size of the data type in its binary serialized format |
int |
getSize(java.lang.Object obj,
gnu.trove.TObjectIntHashMap<java.lang.Object> identities)
|
void |
postConstruction(SerializationFormat format)
Finalize 2-phased construction. |
void |
serialize(BinaryWriteable out,
gnu.trove.TObjectIntHashMap<java.lang.Object> identities,
java.lang.Object obj)
Serialize obj to out. |
void |
skip(BinaryReadable in,
java.util.List<java.lang.Object> identities)
Skip over an object in a stream. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BinarySerializationFormat.GenericUnionSerializer
public BinarySerializationFormat.GenericUnionSerializer(UnionBinding binding)
postConstruction
public void postConstruction(SerializationFormat format)
throws java.lang.RuntimeException
- Description copied from class:
Serializer
- Finalize 2-phased construction.
- Overrides:
postConstruction
in class Serializer
- Throws:
java.lang.RuntimeException
- thrown if construction fails
deserialize
public java.lang.Object deserialize(BinaryReadable in,
java.util.List<java.lang.Object> identities)
throws java.io.IOException,
SerializationException,
BindingException
- Description copied from class:
Serializer
- Deserialize an object from a readable.
The identities argument is a list of identities (in the binary block) of objects
that have already been deserialized. Once deserialized they are added to the list.
Typically an empty list is provided. If the type has no recursion, a
null
value can be provided.
- Specified by:
deserialize
in class Serializer
identities
- empty identities array or null
if there is no recursion
- Returns:
- the instance
- Throws:
java.io.IOException
SerializationException
BindingException
- Could not bind the data into an object
skip
public void skip(BinaryReadable in,
java.util.List<java.lang.Object> identities)
throws java.io.IOException,
SerializationException
- Description copied from class:
Serializer
- Skip over an object in a stream. This method deserializes the object
without producing a result or reading thru all bytes.
- Specified by:
skip
in class Serializer
- Throws:
java.io.IOException
SerializationException
serialize
public void serialize(BinaryWriteable out,
gnu.trove.TObjectIntHashMap<java.lang.Object> identities,
java.lang.Object obj)
throws java.io.IOException,
BindingException,
SerializationException
- Description copied from class:
Serializer
- Serialize obj to out.
The identities argument is a map of identities (in the binary block) and objects
that have already been serialized. Once serialized, an object is added to the map.
Typically an empty map is provided. If the type has no recursion, a
null
value can be provided.
- Specified by:
serialize
in class Serializer
identities
- Thread local empty map or null
if there is no recursion
- Throws:
java.io.IOException
BindingException
SerializationException
getConstantSize
public java.lang.Integer getConstantSize()
- Description copied from class:
Serializer
- Get constant size of the data type in its binary serialized format
- Specified by:
getConstantSize
in class Serializer
- Returns:
- size in bytes or null if not fixed
getSize
public int getSize(java.lang.Object obj,
gnu.trove.TObjectIntHashMap<java.lang.Object> identities)
throws SerializationException,
BindingException
- Specified by:
getSize
in class Serializer
identities
- thread local empty hash map
- Returns:
- number of bytes required to serialize obj
- Throws:
SerializationException
BindingException