public interface InMemoryDataStore
| Modifier and Type | Method and Description |
|---|---|
<T extends Serializable> |
get(String key,
Class<T> type)
Retrieve data from the data store.
|
void |
load(InputStream in)
Load content of the data store from an input stream.
|
<T extends Serializable> |
put(String key,
T data)
Store new data or replace existing data stored under a
key with the new
data. |
void |
save(OutputStream out)
Save current content of the data store to an output stream.
|
<T extends Serializable> Serializable put(String key, T data)
key with the new
data.
The method throws an exception if the key is null.key - a unique identifier of the location where the data should be
stored or replaced. Must not be null.data - new data to be stored under the given key. May be null,
in which case the data will be removed from the store.null if there are no data stored under the given key
or any replaced data previously stored under the key.NullPointerException - in case the key is null.<T extends Serializable> T get(String key, Class<T> type)
key from the data store
and returns the data cast into the Java type specified by type parameter.key - a unique identifier of the location from which the stored data should be
retrieved. Must not be null.type - expected Java type of the data being retrieved. Must not be null.null if there are no data stored under the given
key.NullPointerException - in case the key or type is null.ClassCastException - in case the data stored under the given key
cannot be cast to the Java type represented by
type parameter.void save(OutputStream out) throws IOException
out - output stream where the content of the data store is saved.
The method does not close the stream.IOException - in case the save operation failed.void load(InputStream in) throws IOException
in - input stream from which the content of the data store is loaded.
The method does not close the stream.IOException - in case the load operation failed.Copyright © 2007-2016, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.