public class RelayAdminMessage extends AbstractAdminMessage
CLASSIFIER_ADD_SUBSCRIPTION, CLASSIFIER_BOW_DOWN_TO_NEW_KING, CLASSIFIER_CENSUS_MESSAGE, CLASSIFIER_CLOSE_SERVER_CONNECTION, CLASSIFIER_DISCOVERED_DEVICE, CLASSIFIER_FINISHED_HANDSHAKE, CLASSIFIER_KEEP_ALIVE_MESSAGE, CLASSIFIER_NEW_PRINCE_MESSAGE, CLASSIFIER_PRINCE_ACK, CLASSIFIER_PRINCE_FOUND_A_KING_MESSAGE, CLASSIFIER_REMOVE_SUBSCRIPTION, CLASSIFIER_SERVER_CONNECTION_AVAILABLE, CLASSIFIER_SERVER_CONNECTION_DOWN, CLASSIFIER_SERVER_CONNECTION_RELAY_PAYLOAD, CLASSIFIER_STRING_MESSAGE, gson, HEADER_LENGTH| Constructor and Description |
|---|
RelayAdminMessage(BlaubotMessage rawMessage)
Note: this is only used internally, don't use this to wrap a BlaubotMessage inside the RelayAdminMessage!
|
RelayAdminMessage(byte[] serializedBlaubotMessage) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
BlaubotMessage |
getAsBlaubotMessage() |
byte[] |
getMessageBytes() |
int |
hashCode() |
static void |
main(java.lang.String[] args) |
protected byte[] |
payloadToBytes()
Gets this message's byte representation (NOT including the classifier)
|
protected void |
setUpFromBytes(java.nio.ByteBuffer messagePayloadAsBytes)
Should set the message's attributes based on the message's payload.
|
BlaubotMessage |
toBlaubotMessage()
Creates a
BlaubotMessage representing this AbstractAdminMessage |
java.lang.String |
toString() |
classifierAndPayloadBytes, getClassifier, setClassifierpublic RelayAdminMessage(byte[] serializedBlaubotMessage)
serializedBlaubotMessage - the blaubot message to be relayed to the server as byte array (with header)java.lang.IllegalArgumentException - if the payload (serializedBlaubotMessage) exceeds the maximum payloadpublic RelayAdminMessage(BlaubotMessage rawMessage)
rawMessage - the raw message to extract THIS admin message fromprotected byte[] payloadToBytes()
AbstractAdminMessagepayloadToBytes in class AbstractAdminMessageprotected void setUpFromBytes(java.nio.ByteBuffer messagePayloadAsBytes)
AbstractAdminMessageByteBuffer contains the classifier bytes but it's current
index will be set beyond that.setUpFromBytes in class AbstractAdminMessagemessagePayloadAsBytes - a ByteBuffer wrapped around the message's payload with it's current index set beyond the classifier bytespublic BlaubotMessage getAsBlaubotMessage()
public byte[] getMessageBytes()
public BlaubotMessage toBlaubotMessage()
AbstractAdminMessageBlaubotMessage representing this AbstractAdminMessagetoBlaubotMessage in class AbstractAdminMessageBlaubotMessage representationpublic boolean equals(java.lang.Object o)
equals in class AbstractAdminMessagepublic int hashCode()
hashCode in class AbstractAdminMessagepublic java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)