org.opengis.coverage.grid
Interface GridCoverageReader

All Known Implementing Classes:
AbstractGridCoverage2DReader, AIGReader, ArcGridReader, ArcSDEGridCoverage2DReaderJAI, BaseGDALGridCoverage2DReader, BaseGridCoverage2DReader, DTEDReader, ECWReader, EnviHdrReader, ErdasImgReader, EsriHdrReader, GeoTiffReader, GrassCoverageReader, GTopo30Reader, IDRISIReader, ImageMosaicJDBCReader, ImageMosaicReader, ImagePyramidReader, JP2ECWReader, JP2KReader, JP2KReader, JP2MrSIDReader, MrSIDReader, NITFReader, RPFTOCReader, WorldImageReader

public interface GridCoverageReader

Support for reading grid coverages out of a persisten store. Instance of GridCoverageReader are obtained through a call to GridCoverageExchange#getReader. Grid coverages are usually read from the input stream in a sequential order.

Since:
GeoAPI 2.0
Author:
Martin Desruisseaux (IRD)
See Also:
GridCoverageExchange#getReader, ImageReader

Method Summary
 void dispose()
          Allows any resources held by this object to be released.
 String getCurrentSubname()
          Returns the name for the next grid coverage to be read from the input source.
 Format getFormat()
          Returns the format handled by this GridCoverageReader.
 String[] getMetadataNames()
          Returns the list of metadata keywords associated with the input source as a whole (not associated with any particular grid coverage).
 String getMetadataValue(String name)
          Retrieve the metadata value for a given metadata name.
 Object getSource()
          Returns the input source.
 boolean hasMoreGridCoverages()
          Returns true if there is at least one more grid coverage available on the stream.
 String[] listSubNames()
          Retrieve the list of grid coverages contained within the input source.
 GridCoverage read(GeneralParameterValue[] parameters)
          Read the grid coverage from the current stream position, and move to the next grid coverage.
 void skip()
          Skip the current grid coverage without reading it, and move the stream position to the next grid coverage.
 

Method Detail

getFormat

Format getFormat()
Returns the format handled by this GridCoverageReader.


getSource

Object getSource()
Returns the input source. This is the object passed to the GridCoverageExchange#getReader method. It can be a String, an InputStream, a FileChannel, whatever.


getMetadataNames

String[] getMetadataNames()
                          throws IOException
Returns the list of metadata keywords associated with the input source as a whole (not associated with any particular grid coverage). If no metadata is available, the array will be empty.

Returns:
The list of metadata keywords for the input source.
Throws:
IOException - if an error occurs during reading.

getMetadataValue

String getMetadataValue(String name)
                        throws IOException
Retrieve the metadata value for a given metadata name.

Parameters:
name - Metadata keyword for which to retrieve metadata.
Returns:
The metadata value for the given metadata name. Should be one of the name returned by getMetadataNames().
Throws:
IOException - if an error occurs during reading.

listSubNames

String[] listSubNames()
                      throws IOException
Retrieve the list of grid coverages contained within the input source. Each grid can have a different coordinate system, number of dimensions and grid geometry. For example, a HDF-EOS file (GRID.HDF) contains 6 grid coverages each having a different projection. An empty array will be returned if no sub names exist.

Returns:
The list of grid coverages contained within the input source.
Throws:
IOException - if an error occurs during reading.

getCurrentSubname

String getCurrentSubname()
                         throws IOException
Returns the name for the next grid coverage to be read from the input source.

Throws:
IOException - if an error occurs during reading.

hasMoreGridCoverages

boolean hasMoreGridCoverages()
                             throws IOException
Returns true if there is at least one more grid coverage available on the stream.

Throws:
IOException

read

GridCoverage read(GeneralParameterValue[] parameters)
                  throws IllegalArgumentException,
                         IOException
Read the grid coverage from the current stream position, and move to the next grid coverage. The method hasMoreGridCoverages() should be invoked first in order to verify that a coverage is available.

Parameters:
parameters - An optional set of parameters. Should be any or all of the parameters returned by Format.getReadParameters().
Returns:
A new grid coverage from the input source.
Throws:
InvalidParameterNameException - if a parameter in parameters doesn't have a recognized name.
InvalidParameterValueException - if a parameter in parameters doesn't have a valid value.
ParameterNotFoundException - if a parameter was required for the operation but was not provided in the parameters list.
CannotCreateGridCoverageException - if the coverage can't be created for a logical reason (for example an unsupported format, or an inconsistency found in the data).
IOException - if a read operation failed for some other input/output reason, including FileNotFoundException if no file with the given name can be found, or IIOException if an error was thrown by the underlying image library.
IllegalArgumentException

skip

void skip()
          throws IOException
Skip the current grid coverage without reading it, and move the stream position to the next grid coverage.

Throws:
IOException - if the operation failed.

dispose

void dispose()
             throws IOException
Allows any resources held by this object to be released. The result of calling any other method subsequent to a call to this method is undefined. It is important for applications to call this method when they know they will no longer be using this GridCoverageReader. Otherwise, the reader may continue to hold on to resources indefinitely.

Throws:
IOException - if an error occured while disposing resources (for example while closing a file).


Copyright © 1996-2013 Geotools. All Rights Reserved.