org.opengis.coverage.grid
Interface GridCoverageReader
-
public interface GridCoverageReaderSupport for reading grid coverages out of a persisten store. Instance ofGridCoverageReaderare obtained through a call toGridCoverageExchange.getReader(java.lang.Object). Grid coverages are usually read from the input stream in a sequential order.WARNING: THIS CLASS WILL CHANGE. Current API is derived from OGC Grid Coverages Implementation specification 1.0. We plan to replace it by new interfaces derived from ISO 19123 (Schema for coverage geometry and functions). Current interfaces should be considered as legacy and are included in this distribution only because they were part of GeoAPI 1.0 release. We will try to preserve as much compatibility as possible, but no migration plan has been determined yet.
- Since:
- GeoAPI 2.0
- See Also:
GridCoverageExchange.getReader(java.lang.Object),ImageReader
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voiddispose()Allows any resources held by this object to be released.java.lang.StringgetCurrentSubname()Returns the name for the next grid coverage to be read from the input source.FormatgetFormat()Returns the format handled by thisGridCoverageReader.java.lang.String[]getMetadataNames()Returns the list of metadata keywords associated with the input source as a whole (not associated with any particular grid coverage).java.lang.StringgetMetadataValue(java.lang.String name)Retrieve the metadata value for a given metadata name.java.lang.ObjectgetSource()Returns the input source.booleanhasMoreGridCoverages()Returnstrueif there is at least one more grid coverage available on the stream.java.lang.String[]listSubNames()Retrieve the list of grid coverages contained within the input source.GridCoverageread(GeneralParameterValue[] parameters)Read the grid coverage from the current stream position, and move to the next grid coverage.voidskip()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 thisGridCoverageReader.
-
getSource
java.lang.Object getSource()
Returns the input source. This is the object passed to theGridCoverageExchange.getReader(java.lang.Object)method. It can be aString, anInputStream, aFileChannel, whatever.
-
getMetadataNames
java.lang.String[] getMetadataNames() throws java.io.IOExceptionReturns 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:
java.io.IOException- if an error occurs during reading.
-
getMetadataValue
java.lang.String getMetadataValue(java.lang.String name) throws java.io.IOException, MetadataNameNotFoundExceptionRetrieve 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:
java.io.IOException- if an error occurs during reading.MetadataNameNotFoundException- if there is no value for the specified metadata name.
-
listSubNames
java.lang.String[] listSubNames() throws java.io.IOExceptionRetrieve 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:
java.io.IOException- if an error occurs during reading.
-
getCurrentSubname
java.lang.String getCurrentSubname() throws java.io.IOExceptionReturns the name for the next grid coverage to be read from the input source.- Throws:
java.io.IOException- if an error occurs during reading.
-
hasMoreGridCoverages
boolean hasMoreGridCoverages() throws java.io.IOExceptionReturnstrueif there is at least one more grid coverage available on the stream.- Throws:
java.io.IOException
-
read
GridCoverage read(GeneralParameterValue[] parameters) throws java.lang.IllegalArgumentException, java.io.IOException
Read the grid coverage from the current stream position, and move to the next grid coverage. The methodhasMoreGridCoverages()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 byFormat.getReadParameters().- Returns:
- A new grid coverage from the input source.
- Throws:
InvalidParameterNameException- if a parameter inparametersdoesn't have a recognized name.InvalidParameterValueException- if a parameter inparametersdoesn't have a valid value.ParameterNotFoundException- if a parameter was required for the operation but was not provided in theparameterslist.CannotCreateGridCoverageException- if the coverage can't be created for a logical reason (for example an unsupported format, or an inconsistency found in the data).java.io.IOException- if a read operation failed for some other input/output reason, includingFileNotFoundExceptionif no file with the givennamecan be found, orIIOExceptionif an error was thrown by the underlying image library.java.lang.IllegalArgumentException
-
skip
void skip() throws java.io.IOException
Skip the current grid coverage without reading it, and move the stream position to the next grid coverage.- Throws:
java.io.IOException- if the operation failed.
-
dispose
void dispose() throws java.io.IOExceptionAllows 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 thisGridCoverageReader. Otherwise, the reader may continue to hold on to resources indefinitely.- Throws:
java.io.IOException- if an error occured while disposing resources (for example while closing a file).
-
-
DataMelt 3.0 © DataMelt by jWork.ORG