public abstract class Message extends Attribute
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
emitContent
Is the content emitted as part of the message?
|
protected boolean |
emitTag
Is the tag identifying the message emitted?
|
protected MessageTag |
messageTag
What message tag identifies this message?
|
protected byte[] |
rgbContent
What is the plain text content of the message.
|
DO_NOT_SEND, DontSendAttributes, externalData, objDontSend, objProtected, objUnprotected, PROTECTED, ProtectedAttributes, rgbProtected, UNPROTECTED, UnprotectedAttributes| Constructor and Description |
|---|
Message() |
| Modifier and Type | Method and Description |
|---|---|
static Message |
DecodeFromBytes(byte[] rgbData)
Decode a COSE message object.
|
static Message |
DecodeFromBytes(byte[] rgbData,
MessageTag defaultTag)
Decode a COSE message object.
|
protected abstract void |
DecodeFromCBORObject(com.upokecenter.cbor.CBORObject messageObject)
Given a CBOR tree, parse the message.
|
protected abstract com.upokecenter.cbor.CBORObject |
EncodeCBORObject()
Encode the COSE message object to a CBORObject tree.
|
byte[] |
EncodeToBytes()
Encode the message to a byte array.
|
com.upokecenter.cbor.CBORObject |
EncodeToCBORObject()
Encode the COSE message object to a CBORObject tree.
|
byte[] |
GetContent()
Return the content bytes of the message
|
boolean |
HasContent()
Does the message current have content?
|
void |
SetContent(byte[] rgbData)
Set the content bytes of the message.
|
void |
SetContent(String strData)
Set the content bytes as a text string.
|
addAttribute, addAttribute, addAttribute, AddProtected, AddProtected, AddProtected, AddUnprotected, AddUnprotected, AddUnprotected, findAttribute, findAttribute, findAttribute, findAttribute, getDoNotSendAttributes, getExternal, getProtectedAttributes, getUnprotectedAttributes, removeAttribute, removeAttribute, setExternalprotected boolean emitTag
protected boolean emitContent
protected MessageTag messageTag
protected byte[] rgbContent
public static Message DecodeFromBytes(byte[] rgbData) throws CoseException
rgbData - byte stream to be decodedCoseException - on a decode failurepublic static Message DecodeFromBytes(byte[] rgbData, MessageTag defaultTag) throws CoseException
MessageTag.Unknown
to decode a generic structure with tagging. Use a specific value if
the tagging is absent or if a known structure is passed in.rgbData - byte stream to be decodeddefaultTag - assumed message type to be decodedCoseException - on a decode failure.public byte[] EncodeToBytes()
throws CoseException
CoseException - Internal COSE Exceptionprotected abstract void DecodeFromCBORObject(com.upokecenter.cbor.CBORObject messageObject)
throws CoseException
messageObject - CBORObject to be converted to a message.CoseExceptionprotected abstract com.upokecenter.cbor.CBORObject EncodeCBORObject()
throws CoseException
CoseExceptionpublic com.upokecenter.cbor.CBORObject EncodeToCBORObject()
throws CoseException
CoseExceptionpublic byte[] GetContent()
public boolean HasContent()
public void SetContent(byte[] rgbData)
rgbData - bytes to set as the contentpublic void SetContent(String strData)
strData - string to set as the contentCOSE for Java documentation, generatedin 2016.