Package org.apache.sis.storage

## Class DataStores

- Object
- - Static
  - - DataStores

-     public final class DataStores
      extends Static

  Static convenience methods creating `DataStore` instances from a given storage object. Storage objects are typically `File` or `DataSource` instances, but can also be any other objects documented in the `StorageConnector` class.
  Since:
    0.4

  Defined in the `sis-storage` module

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static DataStore` | `open​(Object storage)` | Creates a `DataStore` for the given storage.
    `static String` | `probeContentType​(Object storage)` | Returns the MIME type of the storage file format, or `null` if unknown or not applicable.
    `static Collection<DataStoreProvider>` | `providers()` | Returns the set of data store providers available at this method invocation time.

    - ### Methods inherited from class Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### providers

          public static Collection<DataStoreProvider> providers()

      Returns the set of data store providers available at this method invocation time. More providers may be added later in a running JVM if new modules are added on the classpath.
      Returns:
        descriptions of available data stores.
      Since:
        0.8

    - #### probeContentType

          public static String probeContentType​(Object storage)
                                         throws DataStoreException

      Returns the MIME type of the storage file format, or `null` if unknown or not applicable.
      Parameters:
        `storage` - the input/output object as a URL, file, image input stream, etc..
      Returns:
        the storage MIME type, or `null` if unknown or not applicable.
      Throws:
        `DataStoreException` - if an error occurred while opening the storage.

    - #### open

          public static DataStore open​(Object storage)
                                throws UnsupportedStorageException,
                                       DataStoreException

      Creates a `DataStore` for the given storage. The `storage` argument can be any of the following types:
      - A `Path` or a `File` for a file or a directory.
      - A `URI` or a `URL` to a distant resource.
      - A `CharSequence` interpreted as a filename or a URL.
      - A `Channel`, `DataInput`, `InputStream` or `Reader`.
      - A `DataSource` or a `Connection` to a JDBC database.
      - Any other `DataStore`-specific object, for example `NetcdfFile`.
      - An existing `StorageConnector` instance.
      Parameters:
        `storage` - the input/output object as a URL, file, image input stream, etc..
      Returns:
        the object to use for reading geospatial data from the given storage.
      Throws:
        `UnsupportedStorageException` - if no `DataStoreProvider` is found for a given storage object.
        `DataStoreException` - if an error occurred while opening the storage.