com.nokia.notifications
Interface NotificationPayload


public interface NotificationPayload

NotificationPayload is the notification payload that is received from the service.


Field Summary
static java.lang.String ENCODING_BASE64
          Encoding value for binary data.
static java.lang.String ENCODING_NONE
          Payload is not encoded.
static java.lang.String ENCODING_STRING
          Encoding value when the payload is plain text.
static java.lang.String TYPE_APPLICATION_OCTET_STREAM
          Content type for binary data.
 
Method Summary
 byte[] getBase64Data()
           Returns the decoded Base64 data.
 java.lang.String getData()
          Returns the payload data as a string.
 java.lang.String getEncoding()
          Returns the encoding type of the data.
 java.lang.String getType()
          Returns the content type of the data.
 

Field Detail

ENCODING_BASE64

static final java.lang.String ENCODING_BASE64
Encoding value for binary data.

It is advised to use encoding value base64 for Base64 encoded content because that is automatically used for binary data that is sent by using the PUT method of the REST API.

See Also:
getEncoding(), Constant Field Values

ENCODING_STRING

static final java.lang.String ENCODING_STRING
Encoding value when the payload is plain text.

See Also:
getEncoding(), Constant Field Values

ENCODING_NONE

static final java.lang.String ENCODING_NONE
Payload is not encoded. MIDlet should handle missing encoding value as ENCODING_STRING.

See Also:
getEncoding(), Constant Field Values

TYPE_APPLICATION_OCTET_STREAM

static final java.lang.String TYPE_APPLICATION_OCTET_STREAM
Content type for binary data.

It is advised to use content type application/octet-stream for binary data because that is automatically used for binary data that is sent by using the PUT method of the REST API.

See Also:
getType(), Constant Field Values
Method Detail

getData

java.lang.String getData()
Returns the payload data as a string.

Returns:
payload data

getEncoding

java.lang.String getEncoding()
Returns the encoding type of the data.

Supported values are ENCODING_BASE64 and ENCODING_STRING but MIDlet specific custom values may also be defined.

Returns:
encoding type string or null if specific encoding value has not been set
See Also:
ENCODING_BASE64, ENCODING_STRING, ENCODING_NONE

getType

java.lang.String getType()
Returns the content type of the data.

Supported value is TYPE_APPLICATION_OCTET_STREAM but MIDlet specific custom values may also be defined. It is recommended to use IANA registered content types.

Returns:
content type string or null if specific content type has not been set
See Also:
TYPE_APPLICATION_OCTET_STREAM

getBase64Data

byte[] getBase64Data()
                     throws java.io.IOException

Returns the decoded Base64 data. This method may only be used if the payload has been encoded by using Base64. An empty array is returned if the payload is empty.

Returns:
the decoded Base64 data
Throws:
java.lang.IllegalStateException - if the encoding is not ENCODING_BASE64
java.io.IOException - if decoding the data failed, e.g. due to invalid encoding