Package com.jme3.network.base.protocol
Class SerializerMessageProtocol
java.lang.Object
com.jme3.network.base.protocol.SerializerMessageProtocol
- All Implemented Interfaces:
MessageProtocol
Implements a MessageProtocol providing message serializer/deserialization
based on the built-in Serializer code.
The protocol is based on a simple length + data format where two bytes represent the (short) length of the data and the rest is the raw data for the Serializers class.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiontoByteBuffer
(Message message, ByteBuffer target) Converts a message to a ByteBuffer using the com.jme3.network.serializing.Serializer and the (short length) + data protocol.toMessage
(ByteBuffer bytes) Creates and returns a message from the properly sized byte buffer using com.jme3.network.serializing.Serializer.
-
Constructor Details
-
SerializerMessageProtocol
public SerializerMessageProtocol()
-
-
Method Details
-
toByteBuffer
Converts a message to a ByteBuffer using the com.jme3.network.serializing.Serializer and the (short length) + data protocol. If target is null then a 32k byte buffer will be created and filled.- Specified by:
toByteBuffer
in interfaceMessageProtocol
-
toMessage
Creates and returns a message from the properly sized byte buffer using com.jme3.network.serializing.Serializer.- Specified by:
toMessage
in interfaceMessageProtocol
-
createBuffer
- Specified by:
createBuffer
in interfaceMessageProtocol
-