|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectGridCoverageStore
GridCoverageReader
public abstract class GridCoverageReader
Base class of 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);
Note: This class is conceptually equivalent to theImageReaderclass provided in the standard Java library. Implementations of this class are often wrappers around a JavaImageReader, converting geodetic coordinates to pixel coordinates before to delegate the reading of pixel values.
ImageReader
| coverage/geotk-coverageio (download) | View source code for this class |
| Field Summary |
|---|
| Fields inherited from class GridCoverageStore |
|---|
abortRequested |
| Constructor Summary | |
|---|---|
protected |
GridCoverageReader()
Creates a new instance. |
| Method Summary | |
|---|---|
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)
Returns the ranges of valid sample values for each band in this format. |
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. |
| Methods inherited from class GridCoverageStore |
|---|
abort, getLocale, getLogLevel, setLocale, setLogLevel |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected GridCoverageReader()
| Method Detail |
|---|
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.
How streams are closed
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.
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.
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.
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
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 class GridCoverageStoreCoverageStoreException - If an error occurs while restoring to the initial state.ImageReader.reset()
public void dispose()
throws CoverageStoreException
dispose in class GridCoverageStoreCoverageStoreException - If an error occurs while disposing resources.ImageReader.dispose()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||