Package com.db4o.io

Class MemoryStorage

  • All Implemented Interfaces:
    Storage

    public class MemoryStorage
    extends java.lang.Object
    implements Storage
    Storage implementation that produces Bin instances that operate in memory. Use this Storage to work with db4o as an in-memory database.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      MemoryBin bin​(java.lang.String uri)
      Returns the memory bin for the given URI for external use.
      void bin​(java.lang.String uri, MemoryBin bin)
      Registers the given bin for this storage with the given URI.
      void delete​(java.lang.String uri)
      Deletes the bin for the given URI from the storage.
      boolean exists​(java.lang.String uri)
      returns true if a MemoryBin with the given URI name already exists in this Storage.
      Bin open​(BinConfiguration config)
      opens a MemoryBin for the given URI (name can be freely chosen).
      void rename​(java.lang.String oldUri, java.lang.String newUri)
      Renames the bin for the given old URI to the new URI.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MemoryStorage

        public MemoryStorage()
      • MemoryStorage

        public MemoryStorage​(GrowthStrategy growthStrategy)
    • Method Detail

      • exists

        public boolean exists​(java.lang.String uri)
        returns true if a MemoryBin with the given URI name already exists in this Storage.
        Specified by:
        exists in interface Storage
      • bin

        public MemoryBin bin​(java.lang.String uri)
        Returns the memory bin for the given URI for external use.
      • bin

        public void bin​(java.lang.String uri,
                        MemoryBin bin)
        Registers the given bin for this storage with the given URI.
      • delete

        public void delete​(java.lang.String uri)
                    throws java.io.IOException
        Description copied from interface: Storage
        Deletes the bin for the given URI from the storage.
        Specified by:
        delete in interface Storage
        Parameters:
        uri - bin URI
        Throws:
        java.io.IOException - if the bin could not be deleted
      • rename

        public void rename​(java.lang.String oldUri,
                           java.lang.String newUri)
                    throws java.io.IOException
        Description copied from interface: Storage
        Renames the bin for the given old URI to the new URI. If a bin for the new URI exists, it will be overwritten.
        Specified by:
        rename in interface Storage
        Parameters:
        oldUri - URI of the existing bin
        newUri - future URI of the bin
        Throws:
        java.io.IOException - if the bin could not be deleted