HttpsSingleMessage Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.device.transport.https.HttpsSingleMessage

Implements

public final class HttpsSingleMessage
implements HttpsMessage

A single HTTPS message.

Field Summary

Modifier and Type Field and Description
protected static final java.lang.String CONTENT_ENCODING_KEY
protected static final java.lang.String CONTENT_TYPE_KEY
protected static final java.lang.String CORRELATION_ID_KEY

The property names as they are saved in the system properties of this object

protected static final java.lang.String MESSAGE_ID_KEY
protected static final java.lang.String TO_KEY
protected static final java.lang.String USER_ID_KEY

Method Summary

Modifier and Type Method and Description
byte[] getBody()

Returns a copy of the message body.

java.lang.String getBodyAsString()

Returns the message body as a string.

java.lang.String getContentType()

Returns the message content-type.

MessageProperty[] getProperties()

Returns a copy of the message properties.

java.util.Map<java.lang.String,java.lang.String> getSystemProperties()

Returns a copy of the message system properties.

boolean isBase64Encoded()

Returns whether the message is Base64-encoded.

static HttpsSingleMessage parseHttpsJsonMessage(Message message)

Returns the HTTPS message represented by the service-bound message for application json format.

static HttpsSingleMessage parseHttpsMessage(HttpsResponse response)

Returns the HTTPS message represented by the HTTPS response.

static HttpsSingleMessage parseHttpsMessage(Message message)

Returns the HTTPS message represented by the service-bound message for binary octets.

Message toMessage()

Returns the Iot Hub message represented by the HTTPS message.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Field Details

CONTENT_ENCODING_KEY

protected static final String CONTENT_ENCODING_KEY

CONTENT_TYPE_KEY

protected static final String CONTENT_TYPE_KEY

CORRELATION_ID_KEY

protected static final String CORRELATION_ID_KEY

The property names as they are saved in the system properties of this object

MESSAGE_ID_KEY

protected static final String MESSAGE_ID_KEY

TO_KEY

protected static final String TO_KEY

USER_ID_KEY

protected static final String USER_ID_KEY

Method Details

getBody

public byte[] getBody()

Returns a copy of the message body.

Returns:

a copy of the message body.

getBodyAsString

public String getBodyAsString()

Returns the message body as a string. The body is encoded using charset UTF-8.

Returns:

the message body as a string.

getContentType

public String getContentType()

Returns the message content-type.

Returns:

the message content-type.

getProperties

public MessageProperty[] getProperties()

Returns a copy of the message properties.

Returns:

a copy of the message properties.

getSystemProperties

public Map<String,String> getSystemProperties()

Returns a copy of the message system properties.

Returns:

a copy of the message system properties.

isBase64Encoded

public boolean isBase64Encoded()

Returns whether the message is Base64-encoded.

Returns:

whether the message is Base64-encoded.

parseHttpsJsonMessage

public static HttpsSingleMessage parseHttpsJsonMessage(Message message)

Returns the HTTPS message represented by the service-bound message for application json format. Content type "application/json;charset=utf-8"

Parameters:

message - the service-bound message to be mapped to its HTTPS message equivalent.

Returns:

the HTTPS message represented by the service-bound message.

parseHttpsMessage

public static HttpsSingleMessage parseHttpsMessage(HttpsResponse response)

Returns the HTTPS message represented by the HTTPS response.

Parameters:

response - the HTTPS response.

Returns:

the HTTPS message represented by the HTTPS response.

parseHttpsMessage

public static HttpsSingleMessage parseHttpsMessage(Message message)

Returns the HTTPS message represented by the service-bound message for binary octets. Content type "binary/octet-stream"

Parameters:

message - the service-bound message to be mapped to its HTTPS message equivalent.

Returns:

the HTTPS message represented by the service-bound message.

toMessage

public Message toMessage()

Returns the Iot Hub message represented by the HTTPS message.

Returns:

the IoT Hub message represented by the HTTPS message.

Applies to