public enum MqttQoS extends Enum<MqttQoS>
| Enum Constant and Description |
|---|
FAILURE
失败
|
QOS0
QoS level 0 至多发送一次,发送即丢弃。
|
QOS1
QoS level 1 至少一次,都要在可变头部中附加一个16位的消息ID,SUBSCRIBE 和 UNSUBSCRIBE 消息使用 QoS level 1。
|
QOS2
QoS level 2 确保只有一次,仅仅在 PUBLISH 类型消息中出现,要求在可变头部中要附加消息ID。
|
| Modifier and Type | Method and Description |
|---|---|
String |
toString() |
short |
value() |
static MqttQoS |
valueOf(int value) |
static MqttQoS |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static MqttQoS[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final MqttQoS QOS0
public static final MqttQoS QOS1
public static final MqttQoS QOS2
public static final MqttQoS FAILURE
public static MqttQoS[] values()
for (MqttQoS c : MqttQoS.values()) System.out.println(c);
public static MqttQoS valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic short value()
public static MqttQoS valueOf(int value)
Copyright © 2025. All rights reserved.