Package org.hcjf.io.net.messages
Class MessageBuffer
- java.lang.Object
-
- org.hcjf.io.net.messages.MessageBuffer
-
public final class MessageBuffer extends java.lang.Object- Author:
- javaito.
-
-
Constructor Summary
Constructors Constructor Description MessageBuffer()
-
Method Summary
Modifier and Type Method Description voidappend(byte[] data)Appends data into the buffer.voidappend(Message message)Appends a message into the buffer.byte[]getBytes()Returns the byte array that represent the message.MessageBuffergetLeftover()Returns the left over data that is a incomplete message.java.util.List<Message>getMessages()Returns the messages decoded contained into the buffer.booleanisComplete()This method indicate when buffer contains some massage decoded.
-
-
-
Method Detail
-
append
public void append(Message message)
Appends a message into the buffer.- Parameters:
message- Message to append.
-
append
public void append(byte[] data)
Appends data into the buffer.- Parameters:
data- Data to append.
-
isComplete
public boolean isComplete()
This method indicate when buffer contains some massage decoded.- Returns:
- Returns true if the buffer contains messages decoded or false in the otherwise.
-
getMessages
public java.util.List<Message> getMessages()
Returns the messages decoded contained into the buffer.- Returns:
- List of decoded messages.
-
getLeftover
public MessageBuffer getLeftover()
Returns the left over data that is a incomplete message.- Returns:
- Left over data.
-
getBytes
public byte[] getBytes()
Returns the byte array that represent the message.- Returns:
- Internal byte array.
-
-