public class MemoryPersistence extends java.lang.Object implements MqttClientPersistence
Constructor and Description |
---|
MemoryPersistence() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears persistence, so that it no longer contains any persisted data.
|
void |
close()
Close the persistent store that was previously opened.
|
boolean |
containsKey(java.lang.String key)
Returns whether or not data is persisted using the specified key.
|
MqttPersistable |
get(java.lang.String key)
Gets the specified data out of the persistent store.
|
java.util.Enumeration |
keys()
Returns an Enumeration over the keys in this persistent data store.
|
void |
open(java.lang.String clientId,
java.lang.String serverURI)
Initialise the persistent store.
|
void |
put(java.lang.String key,
MqttPersistable persistable)
Puts the specified data into the persistent store.
|
void |
remove(java.lang.String key)
Remove the data for the specified key.
|
public void close() throws MqttPersistenceException
MqttClientPersistence
close
in interface MqttClientPersistence
MqttPersistenceException
public java.util.Enumeration keys() throws MqttPersistenceException
MqttClientPersistence
keys
in interface MqttClientPersistence
String
objects.MqttPersistenceException
public MqttPersistable get(java.lang.String key) throws MqttPersistenceException
MqttClientPersistence
get
in interface MqttClientPersistence
key
- the key for the data, which was used when originally saving it.MqttPersistenceException
- if there was a problem getting the data
from the persistent store.public void open(java.lang.String clientId, java.lang.String serverURI) throws MqttPersistenceException
MqttClientPersistence
open
in interface MqttClientPersistence
clientId
- The client for which the persistent store should be opened.serverURI
- The connection string as specified when the MQTT client instance was created.MqttPersistenceException
- if there was a problem opening the persistent store.public void put(java.lang.String key, MqttPersistable persistable) throws MqttPersistenceException
MqttClientPersistence
put
in interface MqttClientPersistence
key
- the key for the data, which will be used later to retrieve it.persistable
- the data to persistMqttPersistenceException
- if there was a problem putting the data
into the persistent store.public void remove(java.lang.String key) throws MqttPersistenceException
MqttClientPersistence
remove
in interface MqttClientPersistence
MqttPersistenceException
public void clear() throws MqttPersistenceException
MqttClientPersistence
clear
in interface MqttClientPersistence
MqttPersistenceException
public boolean containsKey(java.lang.String key) throws MqttPersistenceException
MqttClientPersistence
containsKey
in interface MqttClientPersistence
key
- the key for data, which was used when originally saving it.MqttPersistenceException