public interface IPacketConnector extends IConnector
Modifier and Type | Field and Description |
---|---|
static int |
EVENT_PACKET_CLOSED
Event constant to signal that the packet connector has been
closed.
|
static int |
EVENT_PACKET_RECEIVED
Event constant to signal that a packet has been received.
|
Modifier and Type | Method and Description |
---|---|
void |
addPacketListener(int type,
IListener listener)
Adds a packet listener to receive a particular event.
|
IPacket |
createPacket()
Creates a packet that can be used to receive and transfer data.
|
int |
getPacketLength()
Returns the maximum length of the packet.
|
boolean |
removePacketListener(int type,
IListener listener)
Called to remove a listener for a specified set of events.
|
void |
sendPacket(IPacket packet)
Transfers a packet.
|
getPlugin, release
static final int EVENT_PACKET_CLOSED
static final int EVENT_PACKET_RECEIVED
void addPacketListener(int type, IListener listener)
type
- The type of the event.listener
- The listener to add.boolean removePacketListener(int type, IListener listener)
type
- The type of the events.listener
- The listener to remove.IPacket createPacket() throws java.io.IOException
java.io.IOException
- Thrown if the packet cannot be created.void sendPacket(IPacket packet) throws java.io.IOException
packet
- The packet that contains the payload that is transfered
by the call.java.lang.NullPointerException
- Thrown if the packet is null.java.io.IOException
- Thrown if the transmission failed. This can also
be a result of a previously released connector.int getPacketLength()