Package com.jme3.network.base.protocol
Class GreedyMessageBuffer
java.lang.Object
com.jme3.network.base.protocol.GreedyMessageBuffer
- All Implemented Interfaces:
MessageBuffer
A MessageBuffer implementation that will aggressively create
all messages as byte data comes in. In other words, if there
are four messages in the ByteBuffer passed to addBuffer() then
all of the messages will be deserialized during that call and
queued up for later return. The downside is that, if any of
those messages was going to alter the MessageProtocol serialization
behavior in a way that affects later messages, then problems occur
when those messages are all in one block.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addBytes
(ByteBuffer buffer) Adds byte data to the message buffer.boolean
Returns 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
-
GreedyMessageBuffer
-
-
Method Details
-
pollMessage
Returns the next message in the buffer or null if there are no more messages in the buffer.- Specified by:
pollMessage
in interfaceMessageBuffer
-
hasMessages
public boolean hasMessages()Returns true if there is a message waiting in the buffer.- Specified by:
hasMessages
in interfaceMessageBuffer
-
addBytes
Adds byte data to the message buffer. Returns true if there is a message waiting after this call.- Specified by:
addBytes
in interfaceMessageBuffer
-