public class DefaultPacketHeader extends Object implements PacketHeader
| Constructor and Description |
|---|
DefaultPacketHeader() |
| Modifier and Type | Method and Description |
|---|---|
int |
getLengthSize()
Gets the size of the header's length value.
|
int |
getLengthSize(int length)
Gets the size of the header's length value.
|
boolean |
isLengthVariable()
Gets whether the header's length value can vary in size.
|
int |
readLength(io.netty.buffer.ByteBuf buf,
PacketCodecHelper codecHelper,
int available)
Reads the length of a packet from the given input.
|
int |
readPacketId(io.netty.buffer.ByteBuf buf,
PacketCodecHelper codecHelper)
Reads the ID of a packet from the given input.
|
void |
writeLength(io.netty.buffer.ByteBuf buf,
PacketCodecHelper codecHelper,
int length)
Writes the length of a packet to the given output.
|
void |
writePacketId(io.netty.buffer.ByteBuf buf,
PacketCodecHelper codecHelper,
int packetId)
Writes the ID of a packet to the given output.
|
public boolean isLengthVariable()
PacketHeaderisLengthVariable in interface PacketHeaderpublic int getLengthSize()
PacketHeadergetLengthSize in interface PacketHeaderpublic int getLengthSize(int length)
PacketHeadergetLengthSize in interface PacketHeaderlength - Length value to get the size of.public int readLength(io.netty.buffer.ByteBuf buf,
PacketCodecHelper codecHelper,
int available)
throws IOException
PacketHeaderreadLength in interface PacketHeaderbuf - Buffer to read from.codecHelper - The codec helper.available - Number of packet bytes available after the length.IOException - If an I/O error occurs.public void writeLength(io.netty.buffer.ByteBuf buf,
PacketCodecHelper codecHelper,
int length)
throws IOException
PacketHeaderwriteLength in interface PacketHeaderbuf - Buffer to write to.codecHelper - The codec helper.length - Length to write.IOException - If an I/O error occurs.public int readPacketId(io.netty.buffer.ByteBuf buf,
PacketCodecHelper codecHelper)
throws IOException
PacketHeaderreadPacketId in interface PacketHeaderbuf - Buffer to read from.codecHelper - The codec helper.IOException - If an I/O error occurs.public void writePacketId(io.netty.buffer.ByteBuf buf,
PacketCodecHelper codecHelper,
int packetId)
throws IOException
PacketHeaderwritePacketId in interface PacketHeaderbuf - Buffer to write to.codecHelper - The codec helper.packetId - Packet ID to write.IOException - If an I/O error occurs.Copyright © 2022. All rights reserved.