public class MqttDefaultMicroFilePersistence extends Object implements MqttClientPersistence
Constructor and Description |
---|
MqttDefaultMicroFilePersistence() |
MqttDefaultMicroFilePersistence(String directory) |
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(String key)
Returns whether or not data is persisted using the specified key.
|
MqttPersistable |
get(String key)
Gets the specified data out of the persistent store.
|
Enumeration |
keys()
Returns all of the persistent data from the previously specified persistence directory.
|
void |
open(String clientId,
String theConnection)
Initialise the persistent store.
|
void |
put(String key,
MqttPersistable message)
Puts the specified data into the persistent store.
|
void |
remove(String key)
Deletes the data with the specified key from the previously specified persistence directory.
|
public MqttDefaultMicroFilePersistence() throws IOException
IOException
public MqttDefaultMicroFilePersistence(String directory) throws IOException
IOException
public void open(String clientId, String theConnection) throws MqttPersistenceException
MqttClientPersistence
open
in interface MqttClientPersistence
clientId
- The client for which the persistent store should be opened.theConnection
- The connection string as specified when the MQTT client instance was created.MqttPersistenceException
- if there was a problem opening the persistent store.public void close() throws MqttPersistenceException
MqttClientPersistence
close
in interface MqttClientPersistence
MqttPersistenceException
public void put(String key, MqttPersistable message) throws MqttPersistenceException
MqttClientPersistence
put
in interface MqttClientPersistence
key
- the key for the data, which will be used later to retrieve it.message
- the data to persistMqttPersistenceException
- if there was a problem putting the data
into the persistent store.public MqttPersistable get(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 remove(String key) throws MqttPersistenceException
remove
in interface MqttClientPersistence
MqttPersistenceException
public Enumeration keys() throws MqttPersistenceException
keys
in interface MqttClientPersistence
MqttPersistenceException
public boolean containsKey(String key) throws MqttPersistenceException
MqttClientPersistence
containsKey
in interface MqttClientPersistence
key
- the key for data, which was used when originally saving it.MqttPersistenceException
public void clear() throws MqttPersistenceException
MqttClientPersistence
clear
in interface MqttClientPersistence
MqttPersistenceException