Class MessageBuffer


  • public final class MessageBuffer
    extends java.lang.Object
    Author:
    javaito.
    • Constructor Summary

      Constructors 
      Constructor Description
      MessageBuffer()  
    • Method Summary

      Modifier and Type Method Description
      void append​(byte[] data)
      Appends data into the buffer.
      void append​(Message message)
      Appends a message into the buffer.
      byte[] getBytes()
      Returns the byte array that represent the message.
      MessageBuffer getLeftover()
      Returns the left over data that is a incomplete message.
      java.util.List<Message> getMessages()
      Returns the messages decoded contained into the buffer.
      boolean isComplete()
      This method indicate when buffer contains some massage decoded.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MessageBuffer

        public MessageBuffer()
    • 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.