Class LazyMessageBuffer
java.lang.Object
com.jme3.network.base.protocol.LazyMessageBuffer
- All Implemented Interfaces:
MessageBuffer
A MessageBuffer implementation that will deserialize messages as they
are returned instead of deserializing them as the data comes in. This
allows the individual messages to be processed before later messages
are deserialized, thus allowing the serialization process itself to be
altered mid-stream.
- Author:
- Paul Speed
-
Constructor Summary
ConstructorsConstructorDescriptionLazyMessageBuffer(MessageProtocol protocol) Creates a lazy message buffer for the specified protocol. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddBytes(ByteBuffer buffer) Adds byte data to the message buffer.booleanReturns true if there is a message waiting in the buffer.Returns the next message in the buffer or null if there are no more messages in the buffer.
-
Constructor Details
-
LazyMessageBuffer
Creates a lazy message buffer for the specified protocol.- Parameters:
protocol- the protocol used to deserialize buffered messages
-
-
Method Details
-
pollMessage
Returns the next message in the buffer or null if there are no more messages in the buffer.- Specified by:
pollMessagein interfaceMessageBuffer- Returns:
- the next buffered message, or null if none are ready
-
hasMessages
public boolean hasMessages()Returns true if there is a message waiting in the buffer.- Specified by:
hasMessagesin interfaceMessageBuffer- Returns:
- true if a message can be polled immediately
-
addBytes
Adds byte data to the message buffer. Returns true if there is a message waiting after this call.- Specified by:
addBytesin interfaceMessageBuffer- Parameters:
buffer- the bytes to add- Returns:
- true if a complete message is now available
-