encode

abstract fun encode(streamCipher: StreamCipher, buffer: JagByteBuf, message: T)

Encodes the message into the buffer where the buffer is the out property in Netty. Rather than allocating new byte buf instances, we can directly encode to the out property with most packets. This does not however hold true with pre-computed ones, such as player info, where we must instead write the pre-computed bytes over to out first.

Parameters

buffer

the out buffer in Netty encoders into which the data gets directly written.

message

the message to encode into the buffer.