Interface Container


public interface Container
A container of blobs.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Returns true if the blob identified by this name exists within this container.
    void
    Creates the underlying, physical container.
    boolean
    Deletes this container if it exists, including all blobs contained within.
    boolean
    Returns true if the underlying, physical container exists.
    Gets a reference to a blob with the given name.
    Gets the data store managing this container.
    Gets the reference for this container.
    default URI
    Returns the URI for this container, which can be used with DataStoreFactory.resolveContainer(java.net.URI).
    default List<Blob>
    Returns all blobs stored in this container.
    Returns a stream of all blobs stored in this container.
    default String
    Returns the contents of this container formatted as JSON.
    default String
    toJSON(URI baseURI)
    Returns the contents of this container formatted as JSON.
    default String
    toJSON(URI baseURI, boolean full)
    Returns the contents of this container formatted as JSON.
  • Method Details

    • getDataStore

      DataStore getDataStore()
      Gets the data store managing this container.
      Returns:
      the data store
    • getReference

      Reference getReference()
      Gets the reference for this container.
      Returns:
      the reference
    • getBlob

      Blob getBlob(String name)
      Gets a reference to a blob with the given name.
      Parameters:
      name - the blob name
      Returns:
      the blob reference
    • create

      void create() throws DataStoreException
      Creates the underlying, physical container. Containers are automatically created when writing a blob, so an explicit call to create the container is not required.
      Throws:
      DataStoreException - if an error occurred accessing the data store
    • exists

      boolean exists() throws DataStoreException
      Returns true if the underlying, physical container exists.
      Returns:
      true if the container exists; false otherwise
      Throws:
      DataStoreException - if an error occurred accessing the data store
    • delete

      boolean delete() throws DataStoreException
      Deletes this container if it exists, including all blobs contained within.
      Returns:
      true if the container was deleted; false if the container does not exist
      Throws:
      DataStoreException - if an error occurred accessing the data store
    • streamBlobs

      Stream<Blob> streamBlobs() throws DataStoreException
      Returns a stream of all blobs stored in this container. The caller must close the stream when finished.
      Returns:
      a stream of blobs in this container
      Throws:
      DataStoreException - if an error occurred accessing the data store
    • listBlobs

      default List<Blob> listBlobs() throws DataStoreException
      Returns all blobs stored in this container.
      Returns:
      the blobs in this container
      Throws:
      DataStoreException - if an error occurred accessing the data store
    • contains

      default boolean contains(String name) throws DataStoreException
      Returns true if the blob identified by this name exists within this container.
      Parameters:
      name - the blob name
      Returns:
      true if the blob exists; false otherwise
      Throws:
      DataStoreException - if an error occurred accessing the data store
    • getURI

      default URI getURI()
      Returns the URI for this container, which can be used with DataStoreFactory.resolveContainer(java.net.URI).
      Returns:
      the URI
    • toJSON

      default String toJSON()
      Returns the contents of this container formatted as JSON.
      Returns:
      the JSON string
    • toJSON

      default String toJSON(URI baseURI)
      Returns the contents of this container formatted as JSON.
      Parameters:
      baseURI - the base URI, which is used to produce URLs
      Returns:
      the JSON string
    • toJSON

      default String toJSON(URI baseURI, boolean full)
      Returns the contents of this container formatted as JSON.
      Parameters:
      baseURI - the base URI, which is used to produce URLs
      full - if true, output the full data (can produce large output)
      Returns:
      the JSON string