Class TagValMenuCommandProtocol
java.lang.Object
com.thecoderscorner.menu.remote.protocol.TagValMenuCommandProtocol
- All Implemented Interfaces:
MenuCommandProtocol
A protocol implementation that uses tag value pair notation with a few special text items
in order to create messages that can be transmitted. It is currently the default protocol.
Example of this format: "0=123|1=234~" where key 0 is 123 and key 1 is 234, tilde indicates
the end of the message.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final bytestatic final bytestatic final bytestatic final byte -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromChannel(ByteBuffer buffer) Retrieves a message from the channel, or throws an exception if the message is not fully formed.bytereturns the identifier for this protocol, when used in messagesvoidtoChannel(ByteBuffer buffer, MenuCommand cmd) Puts the command specified into the byte buffer, it is assumed that the callee will flip the channel once complete.
-
Field Details
-
PROTOCOL_TAG_VAL
public static final byte PROTOCOL_TAG_VAL- See Also:
-
START_OF_MSG
public static final byte START_OF_MSG- See Also:
-
END_OF_MSG
public static final byte END_OF_MSG- See Also:
-
FIELD_TERMINATOR
public static final byte FIELD_TERMINATOR- See Also:
-
-
Constructor Details
-
TagValMenuCommandProtocol
public TagValMenuCommandProtocol()
-
-
Method Details
-
fromChannel
Description copied from interface:MenuCommandProtocolRetrieves 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- Specified by:
fromChannelin interfaceMenuCommandProtocol- Throws:
IOException
-
getKeyIdentifier
public byte getKeyIdentifier()Description copied from interface:MenuCommandProtocolreturns the identifier for this protocol, when used in messages- Specified by:
getKeyIdentifierin interfaceMenuCommandProtocol- Returns:
- the ID for this protocol
-