Class InMemoryBlobStore

java.lang.Object
org.mockserver.state.InMemoryBlobStore
All Implemented Interfaces:
AutoCloseable, BlobStore

public class InMemoryBlobStore extends Object implements BlobStore
In-memory BlobStore implementation backed by a ConcurrentHashMap. Blobs are held entirely in memory and are lost on process exit.
  • Constructor Details

    • InMemoryBlobStore

      public InMemoryBlobStore()
  • Method Details

    • put

      public void put(String key, byte[] data, Map<String,String> metadata)
      Description copied from interface: BlobStore
      Stores a blob, overwriting any existing blob with the same key.
      Specified by:
      put in interface BlobStore
      Parameters:
      key - the blob key (e.g. a path-like string)
      data - the binary data
      metadata - optional metadata (may be empty, must not be null)
    • get

      public Optional<Blob> get(String key)
      Description copied from interface: BlobStore
      Retrieves a blob by key.
      Specified by:
      get in interface BlobStore
      Parameters:
      key - the blob key
      Returns:
      the blob, or empty if not present
    • list

      public List<String> list(String prefix)
      Description copied from interface: BlobStore
      Lists all blob keys that start with the given prefix.
      Specified by:
      list in interface BlobStore
      Parameters:
      prefix - the key prefix (e.g. "expectations/")
      Returns:
      list of matching keys
    • delete

      public boolean delete(String key)
      Description copied from interface: BlobStore
      Deletes a blob by key.
      Specified by:
      delete in interface BlobStore
      Parameters:
      key - the blob key
      Returns:
      true if the key was present