Package dev.forbit.server.abstracts
Class Packet
java.lang.Object
dev.forbit.server.abstracts.Packet
- All Implemented Interfaces:
PacketInterface
- Direct Known Subclasses:
GSONPacket
,RawConnectionPacket
,RawPacket
Parent packet class. Defines common behaviour across packets.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
fillBuffer(GMLOutputBuffer buffer)
Fill the buffer with information you want to send to the clientGets the byte buffer of the packet with the header included at the beginning.abstract void
loadBuffer(GMLInputBuffer buffer)
Load information from the input buffer into the class to usetoString()
Returns a GSON serialised string of the objectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface dev.forbit.server.interfaces.PacketInterface
getServer, receive
-
Constructor Details
-
Packet
public Packet()
-
-
Method Details
-
fillBuffer
Fill the buffer with information you want to send to the client- Parameters:
buffer
- the buffer with the header already included.
-
loadBuffer
Load information from the input buffer into the class to use- Parameters:
buffer
- the input (header is already read.)
-
getBuffer
Gets the byte buffer of the packet with the header included at the beginning.- Specified by:
getBuffer
in interfacePacketInterface
- Returns:
- ByteBuffer ready to be sent.
-
toString
Returns a GSON serialised string of the object
-