Interface MenuCommandProtocol

  • All Known Implementing Classes:
    TagValMenuCommandProtocol

    public interface MenuCommandProtocol
    This is a low level part of the API that most people don't need to deal, implementations will translate commands to and from a given protocol.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      MenuCommand fromChannel​(java.nio.ByteBuffer buffer)
      Retrieves a message from the channel, or throws an exception if the message is not fully formed.
      byte getKeyIdentifier()
      returns the identifier for this protocol, when used in messages
      void toChannel​(java.nio.ByteBuffer buffer, MenuCommand cmd)
      Puts the command specified into the byte buffer, it is assumed that the callee will flip the channel once complete.
    • Method Detail

      • fromChannel

        MenuCommand fromChannel​(java.nio.ByteBuffer buffer)
                         throws java.io.IOException
        Retrieves a message from the channel, or throws an exception if the message is not fully formed. It is assumed that the buffer has been suitably flipped ready for reading
        Throws:
        java.io.IOException
      • toChannel

        void toChannel​(java.nio.ByteBuffer buffer,
                       MenuCommand cmd)
        Puts the command specified into the byte buffer, it is assumed that the callee will flip the channel once complete.
        Parameters:
        buffer - to write the data to
        cmd - the command to write
      • getKeyIdentifier

        byte getKeyIdentifier()
        returns the identifier for this protocol, when used in messages
        Returns:
        the ID for this protocol