public interface BinarySerializable
BinarySerializable
interface marks the implementing
class to be able to serialize itself into a stream of bytes provided
by the BinarySerializator
.
The class should be able to reconstruct itself from these data by providing either a constructor or a factory method. The factory method should have the following prototype:
ObjectClass binaryDeserialize(The constructor should have the following prototype:BinaryInput
input,BinarySerializator
serializator) throwsIOException
ClassConstructor(The access specificator of the construtor or the factory method is not important and can be even private.BinaryInput
input,BinarySerializator
serializator) throwsIOException
JavaToBinarySerializable
,
BinarySerializator
Modifier and Type | Method and Description |
---|---|
int |
binarySerialize(BinaryOutput output,
BinarySerializator serializator)
Binary-serialize this object into the
output . |
int |
getBinarySize(BinarySerializator serializator)
Returns the exact size of the binary-serialized version of this object in bytes.
|
int getBinarySize(BinarySerializator serializator)
serializator
- the serializator used to write objectsint binarySerialize(BinaryOutput output, BinarySerializator serializator) throws java.io.IOException
output
.output
- the binary output that this object is serialized intoserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error during serialization