Package org.apache.sis.storage.geotiff
Class GeoTiffStore
-
-
Constructor Summary
Constructors Constructor Description GeoTiffStore(GeoTiffStoreProvider provider, StorageConnector connector)
Creates a new GeoTIFF store from the given file, URL or stream object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends StoreEvent>
voidaddListener(Class<T> eventType, StoreListener<? super T> listener)
Registers a listener to notify when the specified kind of event occurs in this data store.void
close()
Closes this GeoTIFF store and releases any underlying resources.List<GridCoverageResource>
components()
Returns descriptions of all images in this GeoTIFF file.GridCoverageResource
findResource(String sequence)
Returns the image at the given index.Optional<GenericName>
getIdentifier()
Returns an identifier constructed from the name of the TIFF file.Metadata
getMetadata()
Returns information about the dataset as a whole.Optional<ParameterValueGroup>
getOpenParameters()
Returns the parameters used to open this GeoTIFF data store.-
Methods inherited from class DataStore
addWarningListener, getDisplayName, getLocale, getProvider, removeListener, removeWarningListener, setLocale, toString
-
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface Resource
removeListener
-
-
-
-
Constructor Detail
-
GeoTiffStore
public GeoTiffStore(GeoTiffStoreProvider provider, StorageConnector connector) throws DataStoreException
Creates a new GeoTIFF store from the given file, URL or stream object. This constructor invokesStorageConnector.closeAllExcept(Object)
, keeping open only the needed resource.- Parameters:
provider
- the factory that created thisDataStore
instance, ornull
if unspecified.connector
- information about the storage (URL, stream, etc).- Throws:
DataStoreException
- if an error occurred while opening the GeoTIFF file.
-
-
Method Detail
-
getOpenParameters
public Optional<ParameterValueGroup> getOpenParameters()
Returns the parameters used to open this GeoTIFF data store. The parameters are described byGeoTiffStoreProvider.getOpenParameters()
and contains at least a parameter named "location" with aURI
value. The return value may be empty if the storage input can not be described by a URI (for example a GeoTIFF file reading directly from aReadableByteChannel
).- Specified by:
getOpenParameters
in classDataStore
- Returns:
- parameters used for opening this data store.
- See Also:
DataStoreProvider.getOpenParameters()
-
getIdentifier
public Optional<GenericName> getIdentifier() throws DataStoreException
Returns an identifier constructed from the name of the TIFF file. An identifier is available only if the storage input specified at construction time was something convertible toURI
, for example anURL
,File
orPath
.- Specified by:
getIdentifier
in interfaceResource
- Overrides:
getIdentifier
in classDataStore
- Returns:
- the identifier derived from the filename.
- Throws:
DataStoreException
- if an error occurred while fetching the identifier.- Since:
- 1.0
- See Also:
DataStore.getMetadata()
,DataStore.getDisplayName()
-
getMetadata
public Metadata getMetadata() throws DataStoreException
Returns information about the dataset as a whole. The returned metadata object can contain information such as the spatiotemporal extent of the dataset, contact information about the creator or distributor, data quality, usage constraints and more.- Specified by:
getMetadata
in interfaceResource
- Specified by:
getMetadata
in classDataStore
- Returns:
- information about the dataset.
- Throws:
DataStoreException
- if an error occurred while reading the data.- See Also:
DataStore.getIdentifier()
-
components
public List<GridCoverageResource> components() throws DataStoreException
Returns descriptions of all images in this GeoTIFF file. Images are not immediately loaded.If an error occurs during iteration in the returned collection, an unchecked
BackingStoreException
will be thrown with aDataStoreException
as its cause.- Specified by:
components
in interfaceAggregate
- Returns:
- descriptions of all images in this GeoTIFF file.
- Throws:
DataStoreException
- if an error occurred while fetching the image descriptions.- Since:
- 1.0
-
findResource
public GridCoverageResource findResource(String sequence) throws DataStoreException
Returns the image at the given index. Images numbering starts at 1.- Overrides:
findResource
in classDataStore
- Parameters:
sequence
- string representation of the image index, starting at 1.- Returns:
- image at the given index.
- Throws:
DataStoreException
- if the requested image can not be obtained.- See Also:
Resource.getIdentifier()
,FeatureNaming
-
addListener
public <T extends StoreEvent> void addListener(Class<T> eventType, StoreListener<? super T> listener)
Registers a listener to notify when the specified kind of event occurs in this data store. The current implementation of this data store can emit onlyWarningEvent
s; any listener specified for another kind of events will be ignored.- Specified by:
addListener
in interfaceResource
- Overrides:
addListener
in classDataStore
- Type Parameters:
T
- compile-time value of theeventType
argument.- Parameters:
eventType
- type ofStoreEvent
to listen (can not benull
).listener
- listener to notify about events.
-
close
public void close() throws DataStoreException
Closes this GeoTIFF store and releases any underlying resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in classDataStore
- Throws:
DataStoreException
- if an error occurred while closing the GeoTIFF file.
-
-