From cc8ace92f17c8e5aef7d68ff316e5cd038cd36b5 Mon Sep 17 00:00:00 2001 From: Nathan Lasseter Date: Wed, 22 May 2013 15:34:00 +0100 Subject: Initial Commit --- .../eclipse/paho/client/mqttv3/MqttMessage.html | 520 +++++++++++++++++++++ 1 file changed, 520 insertions(+) create mode 100644 libs/org.eclipse.paho.client.mqttv3/org/eclipse/paho/client/mqttv3/MqttMessage.html (limited to 'libs/org.eclipse.paho.client.mqttv3/org/eclipse/paho/client/mqttv3/MqttMessage.html') diff --git a/libs/org.eclipse.paho.client.mqttv3/org/eclipse/paho/client/mqttv3/MqttMessage.html b/libs/org.eclipse.paho.client.mqttv3/org/eclipse/paho/client/mqttv3/MqttMessage.html new file mode 100644 index 0000000..46d0e2d --- /dev/null +++ b/libs/org.eclipse.paho.client.mqttv3/org/eclipse/paho/client/mqttv3/MqttMessage.html @@ -0,0 +1,520 @@ + + + + + + +MqttMessage (MQTT v3 Client API) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + +

+ +org.eclipse.paho.client.mqttv3 +
+Class MqttMessage

+
+java.lang.Object
+  extended byorg.eclipse.paho.client.mqttv3.MqttMessage
+
+
+
+
public class MqttMessage
extends java.lang.Object
+ +

+An MQTT message. The message includes a "payload" (the body of the message) + represented as a byte[]. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + +
+Constructor Summary
MqttMessage() + +
+          Constructs a message with an empty payload, and all other values + set to defaults. + +
MqttMessage(byte[] payload) + +
+          Constructs a message with the specified byte array as a payload, + and all other values set to defaults.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidclearPayload() + +
+          Clears the payload, resetting it to be empty.
+ byte[]getPayload() + +
+          Returns the payload as a byte array.
+ intgetQos() + +
+          Returns the quality of service for this message.
+ booleanisDuplicate() + +
+          Returns whether or not this message might be a duplicate of one which has + already been received.
+ booleanisRetained() + +
+          Returns whether or not this message should be/was retained by the server. +
+ voidsetPayload(byte[] payload) + +
+          Sets the payload of this message to be the specified byte array.
+ voidsetQos(int qos) + +
+          Sets the quality of service for this message. +
+ voidsetRetained(boolean retained) + +
+          Whether or not the publish message should be retained by the messaging engine. +
+ java.lang.StringtoString() + +
+          Returns a string representation of this message.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + + + + +
+Constructor Detail
+ +

+MqttMessage

+
+public MqttMessage()
+
+
Constructs a message with an empty payload, and all other values + set to defaults. + + The defaults are: +
    +
  • Message QoS set to 1
  • +
  • Message will not be "retained" by the server
  • +
+

+

+
+ +

+MqttMessage

+
+public MqttMessage(byte[] payload)
+
+
Constructs a message with the specified byte array as a payload, + and all other values set to defaults. +

+

+ + + + + + + + +
+Method Detail
+ +

+getPayload

+
+public byte[] getPayload()
+                  throws MqttException
+
+
Returns the payload as a byte array. +

+

+ +
Returns:
the payload as a byte array. +
Throws: +
MqttException
+
+
+
+ +

+clearPayload

+
+public void clearPayload()
+
+
Clears the payload, resetting it to be empty. +

+

+ +
Throws: +
java.lang.IllegalStateException - if this message cannot be edited
+
+
+
+ +

+setPayload

+
+public void setPayload(byte[] payload)
+
+
Sets the payload of this message to be the specified byte array. +

+

+
Parameters:
payload - the payload for this message. +
Throws: +
java.lang.IllegalStateException - if this message cannot be edited
+
+
+
+ +

+isRetained

+
+public boolean isRetained()
+
+
Returns whether or not this message should be/was retained by the server. + For messages received from the server, this method returns whether or not + the message was from a current publisher, or was "retained" by the server as + the last message published on the topic. +

+

+ +
Returns:
true if the message should be, or was, retained by + the server.
See Also:
setRetained(boolean)
+
+
+
+ +

+setRetained

+
+public void setRetained(boolean retained)
+
+
Whether or not the publish message should be retained by the messaging engine. + Sending a message with the retained set to false will clear the + retained message from the server. The default value is false +

+

+
Parameters:
retained - whether or not the messaging engine should retain the message. +
Throws: +
java.lang.IllegalStateException - if this message cannot be edited
+
+
+
+ +

+getQos

+
+public int getQos()
+
+
Returns the quality of service for this message. +

+

+ +
Returns:
the quality of service to use, either 0, 1, or 2.
See Also:
setQos(int)
+
+
+
+ +

+setQos

+
+public void setQos(int qos)
+
+
Sets the quality of service for this message. +
    +
  • Quality of service 0 - indicates that a message should + be delivered at most once (zero or one times). The message will not be persisted to disk, + and will not be acknowledged across the network. This QoS is the fastest, + but should only be used for messages which are not valuable - note that + if the server cannot process the message (for example, there + is an authorization problem), then an + MqttCallback.deliveryComplete(MqttDeliveryToken). + Also known as "fire and forget".
  • + +
  • Quality of service 1 - indicates that a message should + be delivered at least once (one or more times). The message can only be delivered safely if + it can be persisted, so the application must supply a means of + persistence using MqttConnectOptions. + If a persistence mechanism is not specified, the message will not be + delivered in the event of a client failure. + The message will be acknowledged across the network. + This is the default QoS.
  • + +
  • Quality of service 2 - indicates that a message should + be delivered once. The message will be persisted to disk, and will + be subject to a two-phase acknowledgement across the network. + The message can only be delivered safely if + it can be persisted, so the application must supply a means of + persistence using MqttConnectOptions. + If a persistence mechanism is not specified, the message will not be + delivered in the event of a client failure.
  • + + If persistence is not configured, QOS 1 and 2 messages will still be delivered + in the event of a network or server problem as the client will hold state in memory. + If the MQTT client is shutdown or fails and persistence is not configured then + delivery of QOS 1 and 2 messages can not be maintained as client side state will + be lost. +

    +

    +
    Parameters:
    qos - the "quality of service" to use. Set to 0, 1, 2. +
    Throws: +
    java.lang.IllegalArgumentException - if value of QoS is not 0, 1 or 2. +
    java.lang.IllegalStateException - if this message cannot be edited
    +
    +
+
+ +

+toString

+
+public java.lang.String toString()
+
+
Returns a string representation of this message. +

+

+ +
Returns:
a string representation of this message.
+
+
+
+ +

+isDuplicate

+
+public boolean isDuplicate()
+
+
Returns whether or not this message might be a duplicate of one which has + already been received. This will only be set on messages received from + the server. +

+

+ +
Returns:
true if the message might be a duplicate.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + -- cgit v1.2.1