Skip to content

API reference / @jsprismarine/protocol / NetworkStructure

Abstract Class: NetworkStructure ​

Defined in: protocol/src/NetworkStructure.ts:8

Base class for protocol structures that read and write fields on a NetworkBinaryStream.

Extended by ​

Constructors ​

Constructor ​

new NetworkStructure(): NetworkStructure

Returns ​

NetworkStructure

Methods ​

deserialize() ​

abstract deserialize(stream): void

Defined in: protocol/src/NetworkStructure.ts:19

Deserializes the network structure from a binary stream.

Parameters ​

stream ​

NetworkBinaryStream

The binary stream to deserialize from.

Returns ​

void


serialize() ​

abstract serialize(stream): void

Defined in: protocol/src/NetworkStructure.ts:13

Serializes the network structure to a binary stream.

Parameters ​

stream ​

NetworkBinaryStream

The binary stream to serialize to.

Returns ​

void


deserialize() ​

static deserialize<T>(this, stream): T

Defined in: protocol/src/NetworkStructure.ts:28

Deserializes the network structure from a binary stream. The constructor runs with no arguments before the stream is read, so the class must tolerate that.

Type Parameters ​

T ​

T extends NetworkStructure

Parameters ​

this ​

Constructor<T>

stream ​

NetworkBinaryStream

The binary stream to deserialize from.

Returns ​

T

An instance of the class T.