public abstract class GridCoverageReader extends GridCoverageStore implements CoverageReader
GridCoverage
readers. Reading is a two steps process:
setInput(Object)
method.read(int, GridCoverageReadParam)
method.Example:
GridCoverageReader reader = ... reader.setInput(new File("MyCoverage.asc")); GridCoverage coverage = reader.read(0, null);
ImageReader
Defined in the geotk-coverage
module
abortRequested
Modifier | Constructor and Description |
---|---|
protected |
GridCoverageReader()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Allows any resources held by this reader to be released.
|
SpatialMetadata |
getCoverageMetadata(int index)
Returns the metadata associated with the given coverage, or
null if none. |
abstract List<? extends GenericName> |
getCoverageNames()
Returns the list of coverage names available from the current input source.
|
abstract GeneralGridGeometry |
getGridGeometry(int index)
Returns the grid geometry for the
GridCoverage to be read at the given index. |
Object |
getInput()
Returns the input which was set by the last call to
setInput(Object) ,
or null if none. |
Metadata |
getMetadata()
Returns the ISO 19115 metadata object associated with the input source as a whole
and each coverages.
|
Map<?,?> |
getProperties(int index)
Returns an optional map of properties associated with the coverage at the given index, or
null if none. |
abstract List<GridSampleDimension> |
getSampleDimensions(int index)
Returns the sample dimensions for each band of the
GridCoverage to be read. |
List<MeasurementRange<?>> |
getSampleValueRanges(int index)
Deprecated.
Not used in practice. Could be a convenience static method working on any
sample dimensions.
|
SpatialMetadata |
getStreamMetadata()
Returns the metadata associated with the input source as a whole, or
null if none. |
abstract GridCoverage |
read(int index,
GridCoverageReadParam param)
Reads the grid coverage.
|
void |
reset()
Restores the
GridCoverageReader to its initial state. |
void |
setInput(Object input)
Sets the input source to the given object.
|
abort, getLocale, getLogLevel, setLocale, setLogLevel
public void setInput(Object input) throws CoverageStoreException
File
or a String
object. But some other types
(e.g. ImageInputStream
) may be accepted
as well depending on the implementation.
GridCoverageReader
from the given input object, then this coverage reader will close the stream when the
reset()
or dispose()
method is invoked, or when a new input is set.input
- The input (typically File
or String
) to be read.IllegalArgumentException
- If the input is not a valid instance for this reader.CoverageStoreException
- If the operation failed.ImageReader.setInput(Object)
public Object getInput() throws CoverageStoreException
setInput(Object)
,
or null
if none.null
if none.CoverageStoreException
- If the operation failed.ImageReader.getInput()
public abstract List<? extends GenericName> getCoverageNames() throws CoverageStoreException, CancellationException
The returned list may be backed by this GridCoverageReader
: it should be used
only as long as this reader and its input source are valid. Iterating over the list
may be costly and the operation performed on the list may throw a
BackingStoreException
.
getCoverageNames
in interface CoverageReader
IllegalStateException
- If the input source has not been set.CoverageStoreException
- If an error occurs while reading the information from the input source.CancellationException
- If GridCoverageStore.abort()
has been invoked in an other thread during
the execution of this method.ImageReader.getNumImages(boolean)
public abstract GeneralGridGeometry getGridGeometry(int index) throws CoverageStoreException, CancellationException
GridCoverage
to be read at the given index.index
- The index of the coverage to be queried.GridCoverage
at the specified index.IllegalStateException
- If the input source has not been set.IndexOutOfBoundsException
- If the supplied index is out of bounds.CoverageStoreException
- If an error occurs while reading the information from the input source.CancellationException
- If GridCoverageStore.abort()
has been invoked in an other thread during
the execution of this method.ImageReader.getWidth(int)
,
ImageReader.getHeight(int)
public abstract List<GridSampleDimension> getSampleDimensions(int index) throws CoverageStoreException, CancellationException
GridCoverage
to be read.
If sample dimensions are not known, then this method returns null
.getSampleDimensions
in interface CoverageReader
index
- The index of the coverage to be queried.GridCoverage
at the specified index,
or null
if none. This list length is equals to the number of bands in the
GridCoverage
.IllegalStateException
- If the input source has not been set.IndexOutOfBoundsException
- If the supplied index is out of bounds.CoverageStoreException
- If an error occurs while reading the information from the input source.CancellationException
- If GridCoverageStore.abort()
has been invoked in an other thread during
the execution of this method.@Deprecated public List<MeasurementRange<?>> getSampleValueRanges(int index) throws CoverageStoreException, CancellationException
The default implementation computes the ranges from the information returned
by getSampleDimensions(int)
, if any.
index
- The index of the coverage to be queried.null
if none.CoverageStoreException
- If an error occurs while reading the information from the input source.CancellationException
- If GridCoverageStore.abort()
has been invoked in an other thread during
the execution of this method.public Metadata getMetadata() throws CoverageStoreException
getGridGeometry(int)
.
Since the relationship between Image I/O metadata and ISO 19115 is not always a "one-to-one" relationship, this method works on a best effort basis.
null
).CoverageStoreException
- If an error occurs while reading the information from the input source.public SpatialMetadata getStreamMetadata() throws CoverageStoreException
null
if none.
The default implementation returns null
in every cases.null
.CoverageStoreException
- If an error occurs while reading the information from the input source.ImageReader.getStreamMetadata()
public SpatialMetadata getCoverageMetadata(int index) throws CoverageStoreException
null
if none.
The default implementation returns null
in every cases.index
- The index of the coverage to be queried.null
.CoverageStoreException
- If an error occurs while reading the information from the input source.ImageReader.getImageMetadata(int)
public Map<?,?> getProperties(int index) throws CoverageStoreException, CancellationException
null
if none. The properties are implementation-specific; they are available to
subclasses for any use. The GridCoverageReader
class will simply gives those
properties to the PropertySource
object to be created by the
read
method, without any processing.
The default implementation returns null
in every cases.
index
- The index of the coverage to be queried.null
if none.CoverageStoreException
- If an error occurs while reading the information from the input source.CancellationException
- If GridCoverageStore.abort()
has been invoked in an other thread during
the execution of this method.public abstract GridCoverage read(int index, GridCoverageReadParam param) throws CoverageStoreException, CancellationException
read
in interface CoverageReader
index
- The index of the coverage to be queried.param
- Optional parameters used to control the reading process, or null
.GridCoverage
at the specified index.IllegalStateException
- if the input source has not been set.IndexOutOfBoundsException
- if the supplied index is out of bounds.CoverageStoreException
- If an error occurs while reading the information from the input source.CancellationException
- If GridCoverageStore.abort()
has been invoked in an other thread during
the execution of this method.ImageReader.read(int)
public void reset() throws CoverageStoreException
GridCoverageReader
to its initial state.reset
in interface CoverageReader
reset
in class GridCoverageStore
CoverageStoreException
- If an error occurs while restoring to the initial state.ImageReader.reset()
public void dispose() throws CoverageStoreException
dispose
in interface CoverageReader
dispose
in class GridCoverageStore
CoverageStoreException
- If an error occurs while disposing resources.ImageReader.dispose()
Copyright © 2009–2017 Geotoolkit.org. All rights reserved.