T - AConnection - owner of this client packet.public abstract class BaseClientPacket<T extends AConnection> extends BasePacket implements Runnable
BasePacket.PacketTypeTYPE_PATTERN| Constructor and Description |
|---|
BaseClientPacket(ByteBuffer buf,
int opcode)
Constructs a new client packet with specified id and data buffer.
|
BaseClientPacket(int opcode)
Constructs a new client packet with specified id.
|
| Modifier and Type | Method and Description |
|---|---|
T |
getConnection() |
int |
getRemainingBytes() |
boolean |
read()
This method reads data from a packet buffer.
|
protected byte[] |
readB(int length)
Read n bytes from this packet buffer, n = length.
|
protected int |
readC()
Read byte from this packet buffer.
|
protected int |
readD()
Read int from this packet buffer.
|
protected double |
readDF()
Read double from this packet buffer.
|
protected float |
readF()
Read double from this packet buffer.
|
protected int |
readH()
Read short from this packet buffer.
|
protected abstract void |
readImpl()
Data reading implementation
|
protected long |
readQ()
Read long from this packet buffer.
|
protected String |
readS()
Read String from this packet buffer.
|
protected abstract void |
runImpl()
Execute this packet action.
|
void |
setBuffer(ByteBuffer buf)
Attach ByteBuffer to this packet.
|
void |
setConnection(T client)
Attach client connection to this packet.
|
getOpcode, getPacketName, getPacketType, setOpcode, toStringpublic BaseClientPacket(ByteBuffer buf, int opcode)
buf - packet data container.opcode - packet opcode.public BaseClientPacket(int opcode)
opcode - packet opcode.public void setBuffer(ByteBuffer buf)
buf - public void setConnection(T client)
client - public final boolean read()
true if reading was successful, otherwise
falseprotected abstract void readImpl()
public final int getRemainingBytes()
protected final int readD()
protected final int readC()
protected final int readH()
protected final double readDF()
protected final float readF()
protected final long readQ()
protected final String readS()
protected final byte[] readB(int length)
length - protected abstract void runImpl()
public final T getConnection()
Copyright © 2014–2015. All rights reserved.