PacketSerializer

interface PacketSerializer<T>

The PacketSerializer interface defines the contract for objects that can be serialized and deserialized to and from byte streams using a ByteArrayDataInput for deserialization and a ByteArrayDataOutput for serialization. Implementing classes must provide methods to serialize objects of type T into a byte stream and deserialize objects of type T from a byte stream.

Parameters

T

The type of object to be serialized and deserialized.

Inheritors

Functions

Link copied to clipboard
@ApiStatus.Internal
abstract fun deserialize(buffer: ByteArrayDataInput): T

Deserialize an object of type T from a byte stream using the provided ByteArrayDataInput. This method reconstructs the object from its serialized form.

Link copied to clipboard
@ApiStatus.Internal
abstract fun serialize(obj: T, buffer: ByteArrayDataOutput)

Serialize an object of type T to a byte stream using the provided ByteArrayDataOutput. This method converts the object into its serialized form.