public abstract class BasePacket extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
BasePacket.PacketType
Enumeration of packet types.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
TYPE_PATTERN
Default packet string representation pattern.
|
| Modifier | Constructor and Description |
|---|---|
protected |
BasePacket(BasePacket.PacketType packetType)
Constructs a new packet with given type.
|
protected |
BasePacket(BasePacket.PacketType packetType,
int opcode)
Constructs a new packet with specified type and id.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getOpcode()
Returns packet opcode.
|
String |
getPacketName()
Returns packet name.
|
BasePacket.PacketType |
getPacketType()
Returns packet type.
|
protected void |
setOpcode(int opcode)
Sets opcode of this packet.
|
String |
toString()
Returns string representation of this packet based on packet type, opcode
and name.
|
public static final String TYPE_PATTERN
protected BasePacket(BasePacket.PacketType packetType, int opcode)
packetType - Type of packetopcode - Id of packetprotected BasePacket(BasePacket.PacketType packetType)
packetType - protected void setOpcode(int opcode)
opcode - public final int getOpcode()
public final BasePacket.PacketType getPacketType()
BasePacket.PacketTypepublic String getPacketName()
Class.getSimpleName()public String toString()
toString in class ObjectTYPE_PATTERN,
Formatter,
String.format(String, Object[])Copyright © 2014–2015. All rights reserved.