Interface IPacket
-
- All Known Implementing Classes:
Packet,PacketClientAuthorization,PacketClientServerChannelMessage,PacketClientServerServiceInfoPublisher,PacketServerSetGlobalLogLevel,PacketServerUpdatePermissions
public interface IPacketA packet represents the message format between a INetworkConnector and a INetworkServer instance Every packet has a channel id, from that the IPacketListenerRegistry, can filter its listeners for handle the IPacket instanceThe default implementation of the IPacket class is the Packet class in the same package
All packets require a channel, header and a body.
The channel id is the id from that the listeners should be filter The header has the specify information or the data that is important The body has binary packet information like for files, or zip compressed data
- See Also:
Packet,INetworkClient,INetworkServer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description byte[]getBody()Returns the packet body, for transport for extra data, like files or zip archives or something elseintgetChannel()Returns the channel id, in that the IPacketListenerRegistry class should the listeners work with that packetde.dytanic.cloudnet.common.document.gson.JsonDocumentgetHeader()The header, contain all important information from the packet, to specify the packet type as channel does and/or can has the data, which that are important to handle withjava.util.UUIDgetUniqueId()Returns the uuid of the packet.default booleanisShowDebug()
-
-
-
Method Detail
-
getUniqueId
java.util.UUID getUniqueId()
Returns the uuid of the packet. Each packet should has a own defined UUID instance, less the callback packets for synchronized messages between client and server- Returns:
- the own uniqueId
-
getChannel
int getChannel()
Returns the channel id, in that the IPacketListenerRegistry class should the listeners work with that packet- Returns:
- the channel id in that the packet is defined
-
getHeader
de.dytanic.cloudnet.common.document.gson.JsonDocument getHeader()
The header, contain all important information from the packet, to specify the packet type as channel does and/or can has the data, which that are important to handle withThe encoding should be UTF-8
- Returns:
- the header as JsonDocument instance from this packet
-
getBody
byte[] getBody()
Returns the packet body, for transport for extra data, like files or zip archives or something elseThe max length of the body can only be (Integer.MAX_VALUE - 1)
- Returns:
- the body as byte array in bytes
-
isShowDebug
default boolean isShowDebug()
- Returns:
- if there should be debug messages for this type of packet
-
-