Package playn.core
Interface Storage
public interface Storage
Stores settings in a key/value map. This will attempt to store persistently, but will fall back
to an in-memory map. Use
isPersisted() to check if the data are being persisted.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a batch of edits to be applied to storage in one transaction. -
Method Summary
Modifier and TypeMethodDescriptionReturns the item associated withkey, or null if no item is associated with it.booleanReturns true if storage data will be persistent across restarts.keys()Returns an object that can be used to iterate over all storage keys.voidremoveItem(String key) Removes the item in the Storage associated with the specified key.voidSets the value associated with the specified key todata.Creates aStorage.Batchthat can be used to effect multiple changes to storage in a single, more efficient, operation.
-
Method Details
-
setItem
Sets the value associated with the specified key todata.- Parameters:
key- identifies the value.data- the value associated with the key, which must not be null.
-
removeItem
Removes the item in the Storage associated with the specified key.- Parameters:
key- identifies the value.
-
getItem
Returns the item associated withkey, or null if no item is associated with it.- Parameters:
key- identifies the value.- Returns:
- the value associated with the given key, or null.
-
startBatch
Storage.Batch startBatch()Creates aStorage.Batchthat can be used to effect multiple changes to storage in a single, more efficient, operation. -
keys
Returns an object that can be used to iterate over all storage keys. Note: changes made to storage while iterating over the keys will not be reflected in the iteration, nor will they conflict with it. -
isPersisted
boolean isPersisted()Returns true if storage data will be persistent across restarts.
-