UnversionedBinarySerializer

A BinarySerializer for an unversioned format of T, supporting nulls. Every value is prefixed with an unsigned byte, where 0 indicates a null value and 1 indicates a non-null value.

This serializer can be swapped out with VersionedBinarySerializer to make format changes, without breaking compatibility. The remaining values (2-255) can then be used to indicate different versions of the format.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
override fun copy(obj: T?): T?

Creates a deep copy of obj.

Link copied to clipboard
abstract fun copyNonNull(obj: T): T

Creates a deep copy of the given non-null obj.

Link copied to clipboard
override fun read(reader: ByteReader): T?

Reads a value of type T? from reader.

Link copied to clipboard
fun <T : Any> BinarySerializer<T>.read(bytes: ByteArray, strict: Boolean = true): T?

Reads a value of type T from bytes.

Link copied to clipboard
abstract fun readUnversioned(reader: ByteReader): T

Reads a non-null value of type T from reader.

Link copied to clipboard
override fun write(obj: T?, writer: ByteWriter)

Writes the given obj of type T? to writer.

Link copied to clipboard

Writes the given obj of type T to a ByteArray.

Link copied to clipboard
abstract fun writeUnversioned(obj: T, writer: ByteWriter)

Writes the given non-null obj of type T to writer.