public class Header extends Object implements HeaderOptions
| Modifier and Type | Field and Description |
|---|---|
static int |
LENGTH
Number of bytes required to represent the header.
|
| Constructor and Description |
|---|
Header(Type type,
Status status,
int length,
int spid) |
Header(Type type,
Status status,
int length,
int spid,
int packetId,
int window) |
Header(Type type,
Status status,
short length,
short spid,
byte packetId,
byte window) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
canDecode(io.netty.buffer.ByteBuf buffer) |
static Header |
create(HeaderOptions options,
int length,
PacketIdProvider packetIdProvider)
|
static Header |
decode(io.netty.buffer.ByteBuf buffer) |
void |
encode(io.netty.buffer.ByteBuf buffer)
Encode a header into a
ByteBuf. |
static void |
encode(io.netty.buffer.ByteBuf buffer,
HeaderOptions options,
int length,
PacketIdProvider packetIdProvider)
Encode a header into a
ByteBuf. |
void |
encode(io.netty.buffer.ByteBuf buffer,
PacketIdProvider packetIdProvider)
Encode a header into a
ByteBuf. |
static void |
encode(io.netty.buffer.ByteBuf buffer,
Type type,
Status status,
int length,
short spid,
byte packetId,
byte window)
Encode the
Header. |
boolean |
equals(Object o) |
short |
getLength() |
byte |
getPacketId() |
short |
getSpid() |
Status |
getStatus()
Status is a bit field used to indicate the message state.
|
Type |
getType()
Defines the type of message.
|
byte |
getWindow() |
int |
hashCode() |
boolean |
is(Status.StatusBit bit)
Check if the header status has set the
Status.StatusBit. |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitand, create, notpublic static final int LENGTH
public static Header create(HeaderOptions options, int length, PacketIdProvider packetIdProvider)
options - the HeaderOptions.length - packet length.packetIdProvider - the PacketIdProvider.Header.IllegalArgumentException - when HeaderOptions or PacketIdProvider is null.public Type getType()
HeaderOptionsgetType in interface HeaderOptionspublic Status getStatus()
HeaderOptionsgetStatus in interface HeaderOptionsStatus.StatusBit.public boolean is(Status.StatusBit bit)
HeaderOptionsStatus.StatusBit.is in interface HeaderOptionsbit - the status bit.true of the bit is set; false otherwise.public short getSpid()
public byte getPacketId()
public byte getWindow()
public short getLength()
public void encode(io.netty.buffer.ByteBuf buffer)
ByteBuf.buffer - the target ByteBuf.public void encode(io.netty.buffer.ByteBuf buffer,
PacketIdProvider packetIdProvider)
ByteBuf.buffer - the target ByteBuf.packetIdProvider - must not be null.IllegalArgumentException - when HeaderOptions or PacketIdProvider is null.public static void encode(io.netty.buffer.ByteBuf buffer,
HeaderOptions options,
int length,
PacketIdProvider packetIdProvider)
ByteBuf.buffer - the target ByteBuf.options - header options.length - packet length.packetIdProvider - must not be null.IllegalArgumentException - when HeaderOptions or PacketIdProvider is null.public static void encode(io.netty.buffer.ByteBuf buffer,
Type type,
Status status,
int length,
short spid,
byte packetId,
byte window)
Header.buffer - the target ByteBuf.type - packet type.status - fragmentation/message status.length - packet length.spid - the spid (unused).packetId - the packet Id.window - the window (unused).public static boolean canDecode(io.netty.buffer.ByteBuf buffer)
buffer - the data buffer to inspect.true if the header can be decoded.public static Header decode(io.netty.buffer.ByteBuf buffer)
buffer - the data buffer.Header.Copyright © 2023. All rights reserved.