Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class MqttTopic
- Object
- MqttTopic
Topic names and topic filters: validation and the
+ / # matching rules of
MQTT 3.1.1 section 4.7.Methods
public static void validateName(String topic) | Checks a topic name, the thing a message is published to. |
public static void validateFilter(String filter) | Checks a topic filter, the thing a subscription is made with. |
public static boolean matches(String filter, String topic) | Tells whether a topic name matches a topic filter. |
Inherited methods
Method details
validateName
public static void validateName(String topic)Checks a topic name, the thing a message is published to.
Throws
IllegalArgumentException when it is empty, contains a wildcard, a NUL
character, or is longer than 65535 UTF-8 bytes
Parameters
topicString- the name
validateFilter
public static void validateFilter(String filter)Checks a topic filter, the thing a subscription is made with.
Throws
IllegalArgumentException when it is empty, has a + that is not a whole
level, a # that is not the whole last level, or a NUL character
Parameters
filterString- the filter
matches
public static boolean matches(String filter, String topic)Tells whether a topic name matches a topic filter. A filter that starts
with a wildcard does not match a name that starts with
$.Parameters
filterString- a valid topic filter
topicString- a valid topic name
Returns
true when the name is covered by the filter