Package org.apache.sis.storage
Class DataStores
java.lang.Object
org.apache.sis.util.Static
org.apache.sis.storage.DataStores
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
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static DataStoreRegistry
The registry to use for searching forDataStoreProvider
implementations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DataStore
Creates aDataStore
for the given storage.static String
probeContentType
(Object storage) Returns the MIME type of the storage file format, ornull
if unknown or not applicable.static Collection
<DataStoreProvider> Returns the set of data store providers available at this method invocation time.private static DataStoreRegistry
registry()
Returns the registry, created when first needed.
-
Field Details
-
registry
The registry to use for searching forDataStoreProvider
implementations.Class loader
In current implementation, this registry is instantiated when first needed using the context class loader. This means that the set of available formats may depend on the first thread that invoked aDataStores
method.
-
-
Constructor Details
-
DataStores
private DataStores()Do not allow instantiation of this class.
-
-
Method Details
-
registry
Returns the registry, created when first needed. -
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
Returns the MIME type of the storage file format, ornull
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
Creates aDataStore
for the given storage. Thestorage
argument can be any of the following types:- A
Path
or aFile
for a file or a directory. - A
URI
or aURL
to a distant resource. - A
CharSequence
interpreted as a filename or a URL. - A
Channel
,DataInput
,InputStream
orReader
. - A
DataSource
or aConnection
to a JDBC database. - Any other
DataStore
-specific object, for exampleinvalid reference
ucar.nc2.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 noDataStoreProvider
is found for a given storage object.DataStoreException
- if an error occurred while opening the storage.
- A
-