Interface IPacket
-
- All Known Implementing Classes:
ChunkedPacket,Packet,PacketClientAuthorization,PacketClientDriverAPI,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[]getBodyAsArray()ProtocolBuffergetBuffer()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 packetlonggetCreationMillis()de.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 with@NotNull java.util.UUIDgetUniqueId()Returns the uuid of the packet.default booleanisShowDebug()
-
-
-
Method Detail
-
getUniqueId
@NotNull @NotNull 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
-
getBuffer
ProtocolBuffer getBuffer()
Returns the packet body, for transport for extra data, like files or zip archives or something else- Returns:
- the body as a ProtocolBuffer
-
getBodyAsArray
byte[] getBodyAsArray()
- Returns:
- the body as a byte array
-
getCreationMillis
long getCreationMillis()
- Returns:
- the creation milliseconds of this packet
-
isShowDebug
default boolean isShowDebug()
- Returns:
- if there should be debug messages for this type of packet
-
-