Class PacketReading
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
Modifier and TypeClassDescriptionstatic final record
static interface
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
maxPacketSize
(ConnectionState state) static PacketReading.Result
<ClientPacket> readClient
(@NotNull NetworkBuffer buffer, @NotNull ConnectionState state, boolean compressed) static PacketReading.Result
<ClientPacket> readClients
(@NotNull NetworkBuffer buffer, @NotNull ConnectionState state, boolean compressed) static <T> PacketReading.Result
<T> readPacket
(@NotNull NetworkBuffer buffer, @NotNull PacketParser<T> parser, @NotNull ConnectionState state, @NotNull BiFunction<T, ConnectionState, ConnectionState> stateUpdater, boolean compressed) static <T> PacketReading.Result
<T> readPackets
(@NotNull NetworkBuffer buffer, @NotNull PacketParser<T> parser, @NotNull ConnectionState state, @NotNull BiFunction<T, ConnectionState, ConnectionState> stateUpdater, boolean compressed) static PacketReading.Result
<ServerPacket> readServer
(@NotNull NetworkBuffer buffer, @NotNull ConnectionState state, boolean compressed) static PacketReading.Result
<ServerPacket> readServers
(@NotNull NetworkBuffer buffer, @NotNull ConnectionState state, boolean compressed)
-
Constructor Details
-
PacketReading
public PacketReading()
-
-
Method Details
-
readClients
public static PacketReading.Result<ClientPacket> readClients(@NotNull @NotNull NetworkBuffer buffer, @NotNull @NotNull ConnectionState state, boolean compressed) throws DataFormatException - Throws:
DataFormatException
-
readServers
public static PacketReading.Result<ServerPacket> readServers(@NotNull @NotNull NetworkBuffer buffer, @NotNull @NotNull ConnectionState state, boolean compressed) throws DataFormatException - Throws:
DataFormatException
-
readPackets
public static <T> PacketReading.Result<T> readPackets(@NotNull @NotNull NetworkBuffer buffer, @NotNull @NotNull PacketParser<T> parser, @NotNull @NotNull ConnectionState state, @NotNull @NotNull BiFunction<T, ConnectionState, throws DataFormatExceptionConnectionState> stateUpdater, boolean compressed) - Throws:
DataFormatException
-
readClient
public static PacketReading.Result<ClientPacket> readClient(@NotNull @NotNull NetworkBuffer buffer, @NotNull @NotNull ConnectionState state, boolean compressed) throws DataFormatException - Throws:
DataFormatException
-
readServer
public static PacketReading.Result<ServerPacket> readServer(@NotNull @NotNull NetworkBuffer buffer, @NotNull @NotNull ConnectionState state, boolean compressed) throws DataFormatException - Throws:
DataFormatException
-
readPacket
public static <T> PacketReading.Result<T> readPacket(@NotNull @NotNull NetworkBuffer buffer, @NotNull @NotNull PacketParser<T> parser, @NotNull @NotNull ConnectionState state, @NotNull @NotNull BiFunction<T, ConnectionState, throws DataFormatExceptionConnectionState> stateUpdater, boolean compressed) - Throws:
DataFormatException
-
maxPacketSize
-