Divooka.Interface.Serialization

Divooka.Interface.Serialization.IBinarySerializable

Declares a parameter constructor class that can be serialized from and into bytes[].

Remarks

Useful for Preview node serialization.

Divooka.Interface.Serialization.IBinarySerializable.SerializeIntoBytes

Serialize all data of current instance into bytes.

Returns

Complete representation of the object in bytes

Divooka.Interface.Serialization.IBinarySerializable.InitializeFromBytes()

Initialize a newly constructed instance from bytes

Divooka.Interface.Serialization.IStreamSerializable

Declaras the current object can participate in stream based serialization.

Remarks

Notice not all streams supports seeking so we require explicit size calculations. No particular use case now except for PixelImage.

Divooka.Interface.Serialization.IStreamSerializable.WriteToStream()

Writes into stream.

Parameters

NameDescriptionDefault
writer

Returns

How many bytes are written.

Divooka.Interface.Serialization.IStreamSerializable.ReadFromStream()

Read from stream.

Parameters

NameDescriptionDefault
reader

Returns

How many bytes are read.

Divooka.Interface.Serialization.IDivookaSerializer

A class with parameterless constructor that can serialize/deserialize into required obejcts. Mostly used by specific Payload-type objects and anything that can be saved as part of the graph. Parcel serializable features are two fold: They can be represented safely as self-contained texts (not necessarily JSON); and they can serialize into binary data. For binary data, depending on where/when or how controlled the environment is, it may be serialized directly from/into bytes[], or give full access to the underlying BinaryReader/BinaryWriter.

Divooka.Interface.Serialization.IDivookaSerializer.Serialize

Serializes the current instance into a binary format.

Returns

A byte array containing the serialized representation of the current instance.

Divooka.Interface.Serialization.IDivookaSerializer.Deserialize()

Deserializes binary data into an instance of Divooka.Interface.Serialization.IDivookaSerializer.

Parameters

NameDescriptionDefault
data The byte array containing the serialized data.
length The number of bytes to read from the data array.
offset The starting offset in the data array from where to begin reading. Defaults to 0.

Returns

An instance of Divooka.Interface.Serialization.IDivookaSerializer deserialized from the specified data.

Divooka.Interface.Serialization.IDivookaSerializer.DeserializeBatchMessage()

Deserializes a batch of Divooka.Interface.Serialization.IDivookaSerializer objects from a single binary message.

Parameters

NameDescriptionDefault
data The byte array containing the concatenated serialized messages.
length The total number of bytes to read from the data array.
offset The starting offset in the data array from where to begin reading. Defaults to 0.

Returns

An array of Divooka.Interface.Serialization.IDivookaSerializer objects that have been deserialized from the batch message.

Divooka.Interface.Serialization.IDivookaSerializer.WriteToStream()

Parameters

NameDescriptionDefault
writer The System.IO.BinaryWriter used to write the data.
data The Divooka.Interface.Serialization.IDivookaSerializer instance to serialize.

Divooka.Interface.Serialization.IDivookaSerializer.ReadFromStream()

Parameters

NameDescriptionDefault
reader The System.IO.BinaryReader used to read the data.
consumedBytes When the method returns, contains the number of bytes that were read from the stream for the object.

Returns

Divooka.Interface.Serialization.IDivookaSerializer.ToText

Serializes the current instance into a textual representation.

Returns

A string that represents the serialized form of the current instance.

Divooka.Interface.Serialization.IDivookaSerializer.FromText()

Deserializes an instance of Divooka.Interface.Serialization.IDivookaSerializer from the specified text.

Parameters

NameDescriptionDefault
text The text containing the serialized data.

Returns

An instance of Divooka.Interface.Serialization.IDivookaSerializer deserialized from the specified text.