java.lang.Object
net.minestom.server.network.packet.PacketReading
Tools to read packets from a
NetworkBuffer
for network processing.
Fairly internal and performance sensitive.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
static interface
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
maxPacketSize
(ConnectionState state) static PacketReading.Result
<ClientPacket> readClient
(NetworkBuffer buffer, ConnectionState state, boolean compressed) static PacketReading.Result
<ClientPacket> readClients
(NetworkBuffer buffer, ConnectionState state, boolean compressed) static <T> PacketReading.Result
<T> readPacket
(NetworkBuffer buffer, PacketParser<T> parser, ConnectionState state, BiFunction<T, ConnectionState, ConnectionState> stateUpdater, boolean compressed) static <T> PacketReading.Result
<T> readPackets
(NetworkBuffer buffer, PacketParser<T> parser, ConnectionState state, BiFunction<T, ConnectionState, ConnectionState> stateUpdater, boolean compressed) static PacketReading.Result
<ServerPacket> readServer
(NetworkBuffer buffer, ConnectionState state, boolean compressed) static PacketReading.Result
<ServerPacket> readServers
(NetworkBuffer buffer, ConnectionState state, boolean compressed)
-
Constructor Details
-
PacketReading
public PacketReading()
-
-
Method Details
-
readClients
public static PacketReading.Result<ClientPacket> readClients(NetworkBuffer buffer, ConnectionState state, boolean compressed) throws DataFormatException - Throws:
DataFormatException
-
readServers
public static PacketReading.Result<ServerPacket> readServers(NetworkBuffer buffer, ConnectionState state, boolean compressed) throws DataFormatException - Throws:
DataFormatException
-
readPackets
public static <T> PacketReading.Result<T> readPackets(NetworkBuffer buffer, PacketParser<T> parser, ConnectionState state, BiFunction<T, ConnectionState, throws DataFormatExceptionConnectionState> stateUpdater, boolean compressed) - Throws:
DataFormatException
-
readClient
public static PacketReading.Result<ClientPacket> readClient(NetworkBuffer buffer, ConnectionState state, boolean compressed) throws DataFormatException - Throws:
DataFormatException
-
readServer
public static PacketReading.Result<ServerPacket> readServer(NetworkBuffer buffer, ConnectionState state, boolean compressed) throws DataFormatException - Throws:
DataFormatException
-
readPacket
public static <T> PacketReading.Result<T> readPacket(NetworkBuffer buffer, PacketParser<T> parser, ConnectionState state, BiFunction<T, ConnectionState, throws DataFormatExceptionConnectionState> stateUpdater, boolean compressed) - Throws:
DataFormatException
-
maxPacketSize
-