|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.io.coverage.GridCoverageReader
AbstractGridCoverageReader
.
Base class for reading GridCoverage
objects.
Reading is a two steps process: The input file must
be set first, then the actual reading is performed
with the getGridCoverage(int)
. Example:
Subclasses needs to implements at least the following methods: The default implementation should be able to create acceptable grid coverage using informations provided by the two above-mentioned methods. However, other methods may be overriden too in order to get finner control on the result.GridCoverageReader reader = ... reader.setInput
(new File("MyCoverage.dat"), true); GridCoverage coverage = reader.getGridCoverage
(0);
Field Summary | |
java.lang.String |
formatName
Deprecated. The format name (e.g. |
protected javax.imageio.ImageReader |
reader
Deprecated. The ImageReader to use for decoding RenderedImage s.
|
Constructor Summary | |
GridCoverageReader(java.lang.String formatName)
Deprecated. Construct a GridCoverageReader
for the specified format name. |
Method Summary | |
abstract CoordinateSystem |
getCoordinateSystem(int index)
Deprecated. Returns the coordinate system for the GridCoverage to be read. |
abstract Envelope |
getEnvelope(int index)
Deprecated. Returns the envelope for the GridCoverage to be read.
|
GridCoverage |
getGridCoverage(int index)
Deprecated. Read the grid coverage. |
GridRange |
getGridRange(int index)
Deprecated. Returns the grid range for the GridCoverage to be read.
|
protected java.util.Iterator |
getImageReaders(java.lang.Object input)
Deprecated. Returns an Iterator containing all currently registered
ImageReader s that claim to be able to decode the image.
|
java.util.Locale |
getLocale()
Deprecated. Returns the currently set Locale ,
or null if none has been set. |
java.lang.String |
getName(int index)
Deprecated. Gets the GridCoverage name at the specified index.
|
int |
getNumImages(boolean allowSearch)
Deprecated. Returns the number of images available from the current input source. |
SampleDimension[] |
getSampleDimensions(int index)
Deprecated. Returns the sample dimensions for each band of the GridCoverage
to be read. |
void |
reset()
Deprecated. Restores the GridCoverageReader to its initial state. |
void |
setInput(java.lang.Object input,
boolean seekForwardOnly)
Deprecated. Sets the input source to the given object. |
void |
setLocale(java.util.Locale locale)
Deprecated. Sets the current Locale of this GridCoverageReader
to the given value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public final java.lang.String formatName
ImageIO.getImageReadersByFormatName(String)
,
unless getImageReaders(java.lang.Object)
is overriden.
protected javax.imageio.ImageReader reader
ImageReader
to use for decoding RenderedImage
s.
This reader is initially null
and lazily created the
first time setInput(java.lang.Object, boolean)
is invoked. Once created, it is reused
as much as possible. Invoking reset()
dispose the reader and
set it back to null
.
Constructor Detail |
public GridCoverageReader(java.lang.String formatName)
GridCoverageReader
for the specified format name.
Method Detail |
public void reset() throws java.io.IOException
GridCoverageReader
to its initial state.
java.io.IOException
- if an error occurs while disposing resources.public void setInput(java.lang.Object input, boolean seekForwardOnly) throws java.io.IOException
File
or an URL
object. But some other types (e.g.
ImageInputStream
) may be accepted too.
reset()
, then it will queries getImageReaders(java.lang.Object)
for
a list of ImageReader
s and select the first one that accept
the input.
input
- The File
or URL
to be read.seekForwardOnly
- if true
, grid coverages
and metadata may only be read in ascending order from
the input source.
java.io.IOException
- if an I/O operation failed.
java.lang.IllegalArgumentException
- if input is not an instance
of one of the classes declared by the ImageReader
service provider.public int getNumImages(boolean allowSearch) throws java.io.IOException
allowSearch
parameter may be set to false
to indicate that an exhaustive search is not desired.
allowSearch
- If true
, the true number of images will
be returned even if a search is required. If false
,
the reader may return -1 without performing the search.
allowSearch
is
false
and a search would be required.
java.lang.IllegalStateException
- If the input source has not been set, or if
the input has been specified with seekForwardOnly
set
to true
.
java.io.IOException
- If an error occurs reading the information from the input
source.public java.lang.String getName(int index) throws java.io.IOException
GridCoverage
name at the specified index.
Default implementation returns the input path, or the
"Untitled" string if input is not a File
or an
URL
object.
index
- The index of the image to be queried.
GridCoverage
at the specified index.
java.lang.IllegalStateException
- if the input source has not been set.
java.lang.IndexOutOfBoundsException
- if the supplied index is out of bounds.
java.io.IOException
- if an error occurs reading the width information from the input source.public abstract CoordinateSystem getCoordinateSystem(int index) throws java.io.IOException
GridCoverage
to be read.
index
- The index of the image to be queried.
GridCoverage
at the specified index.
java.lang.IllegalStateException
- if the input source has not been set.
java.lang.IndexOutOfBoundsException
- if the supplied index is out of bounds.
java.io.IOException
- if an error occurs reading the width information from the input source.public abstract Envelope getEnvelope(int index) throws java.io.IOException
GridCoverage
to be read.
The envelope must have the same number of dimensions than the
coordinate system.
index
- The index of the image to be queried.
GridCoverage
at the specified index.
java.lang.IllegalStateException
- if the input source has not been set.
java.lang.IndexOutOfBoundsException
- if the supplied index is out of bounds.
java.io.IOException
- if an error occurs reading the width information from
the input source.public GridRange getGridRange(int index) throws java.io.IOException
GridCoverage
to be read.
The grid range must have the same number of dimensions than the
envelope.
The default implementation construct a GridRange
object
using information provided by ImageReader.getWidth(int)
and
ImageReader.getHeight(int)
.
index
- The index of the image to be queried.
GridCoverage
at the specified index.
java.lang.IllegalStateException
- if the input source has not been set.
java.lang.IndexOutOfBoundsException
- if the supplied index is out of bounds.
java.io.IOException
- if an error occurs reading the width information from
the input source.public SampleDimension[] getSampleDimensions(int index) throws java.io.IOException
GridCoverage
to be read. If sample dimensions are not known, then this method returns
null
. The default implementation always returns null
.
index
- The index of the image to be queried.
GridCoverage
at the specified index.
This array's length must be equals to the number of bands in GridCoverage
.
java.lang.IllegalStateException
- if the input source has not been set.
java.lang.IndexOutOfBoundsException
- if the supplied index is out of bounds.
java.io.IOException
- if an error occurs reading the width information from
the input source.public GridCoverage getGridCoverage(int index) throws java.io.IOException
ImageReadParam
and checks if it is an instance of
RawBinaryImageReadParam
. If it is, this method then invokes
RawBinaryImageReadParam#setStreamImageSize
with informations
provided by getGridRange(int)
. Finally, a grid coverage is
constructed using informations provided by getName(int)
,
getCoordinateSystem(int)
and getEnvelope(int)
.
index
- The index of the image to be queried.
GridCoverage
at the specified index.
java.lang.IllegalStateException
- if the input source has not been set.
java.lang.IndexOutOfBoundsException
- if the supplied index is out of bounds.
java.io.IOException
- if an error occurs reading the width information from
the input source.protected java.util.Iterator getImageReaders(java.lang.Object input)
Iterator
containing all currently registered
ImageReader
s that claim to be able to decode the image.
The default implementation returns
ImageIO.getImageReadersByFormatName(formatName
)
.
input
- The input source.public void setLocale(java.util.Locale locale)
Locale
of this GridCoverageReader
to the given value. A value of null
removes any previous
setting, and indicates that the reader should localize as it sees fit.
public java.util.Locale getLocale()
Locale
,
or null
if none has been set.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |