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 Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Represents a batch of edits to be applied to storage in one transaction.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the item associated with key, or null if no item is associated with it.
    boolean
    Returns true if storage data will be persistent across restarts.
    Returns an object that can be used to iterate over all storage keys.
    void
    Removes the item in the Storage associated with the specified key.
    void
    setItem(String key, String data)
    Sets the value associated with the specified key to data.
    Creates a Storage.Batch that can be used to effect multiple changes to storage in a single, more efficient, operation.
  • Method Details

    • setItem

      void setItem(String key, String data)
      Sets the value associated with the specified key to data.
      Parameters:
      key - identifies the value.
      data - the value associated with the key, which must not be null.
    • removeItem

      void removeItem(String key)
      Removes the item in the Storage associated with the specified key.
      Parameters:
      key - identifies the value.
    • getItem

      String getItem(String key)
      Returns the item associated with key, 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 a Storage.Batch that can be used to effect multiple changes to storage in a single, more efficient, operation.
    • keys

      Iterable<String> 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.