Serializer

Description

sealed class Tinman.Core.IO.Serialization.Serializer

Derived from

SerializerStream abstract

Default implementation of the ISerializable interface that uses an IDataStream for reading and writing binary data.

Public / Constants

Int32


public static readonly attribute Int32 → (ITypeSerializer<int32>)

An instance of ITypeSerializer for signed 32-bit integers.

Var​Int32


public static readonly attribute VarInt32 → (ITypeSerializer<int32>)

An instance of ITypeSerializer for signed 32-bit integers.

Public / Constructors

For


public static method For → (1)

stream in : IDataStream

[not-null]
The data stream to use.

returns → Serializer

The created ISerializer object.

Creates a new instance of ISerializer.

Public / Methods

Clone


public static method Clone → (1)

obj in : ISerializable

The object to clone.

returns → ISerializable

The cloned object.

Clones the given serializable object.

The clone is created by first serializing the given object and then deserializing the clone from the binary data stream.

Deserialize

3 overloads


[OwnerReturn]
public static method Deserialize1 → (1)

stream in : IDataStream own

[not-null]
The data stream.

returns → ISerializable

The deserialized object or null.

Deserializes an object from the given data stream.

IOException

If an I/O error has occurred or if the data in stream in is malformed.


[OwnerReturn]
public static method Deserialize2 → (1)

buffer in : ByteBuffer own

The byte buffer.

returns → ISerializable

The deserialized object or null if the serialized object was null or buffer in is null.

Deserializes an object from the given byte buffer.

ByteOrder.LittleEndian will be used for reading multi-byte values.

IOException

If the data in buffer in is malformed.


[OwnerReturn]
public static method Deserialize3 → (1)

file in : Path

[not-null]
The file path.

returns → ISerializable

The deserialized object or null.

Deserializes an object from the given file.

ByteOrder.LittleEndian will be used for reading multi-byte values.

IOException

If an I/O error has occurred or if the data in file in is malformed.

Serialize

3 overloads


[OwnerReturn]
public static method Serialize1 → (2)

obj in : ISerializable

The object to serialize or null.

stream in : IDataStream

[not-null]
The stream to serialize to.

Serializes the given object.

IOException

If an I/O error has occurred.


[OwnerReturn]
public static method Serialize2 → (1)

obj in : ISerializable

The object to serialize or null.

returns → ByteBuffer

The byte buffer that holds the serialized object data.

Serializes the given object.

ByteOrder.LittleEndian will be used for writing multi-byte values.


public static method Serialize3 → (2)

obj in : ISerializable

The object to serialize or null.

file in : Path

[not-null]
The file path.

Serializes the given object to the given file.

ByteOrder.LittleEndian will be used for writing multi-byte values.

IOException

If an I/O error has occurred.