org.geotools.gce.image
Class WorldImageReader

java.lang.Object
  extended byorg.geotools.gce.image.WorldImageReader
All Implemented Interfaces:
org.opengis.coverage.grid.GridCoverageReader

public class WorldImageReader
extends java.lang.Object
implements org.opengis.coverage.grid.GridCoverageReader

Reads a GridCoverage from a given source. WorldImage sources only support one GridCoverage so hasMoreGridCoverages() will return true until the only GridCoverage is read. No metadata is currently supported, so all related methods return null. In the early future we will start (hopefully supporting them).

Version:
$Id: WorldImageReader.java 17700 2006-01-22 23:30:39Z desruisseaux $
Author:
simone giannecchini, alessio fabiani, rgould

Constructor Summary
WorldImageReader(java.lang.Object source)
          Class constructor.
 
Method Summary
 void dispose()
          Cleans up the Reader (currently does nothing)
 java.lang.String getCurrentSubname()
          WorldImage GridCoverages are not named.
 org.opengis.coverage.grid.Format getFormat()
          Returns the format that this Reader accepts.
 java.lang.String[] getMetadataNames()
          Metadata is not suported.
 java.lang.String getMetadataValue(java.lang.String name)
          Metadata is not supported.
 java.lang.Object getSource()
          Returns the source object containing the GridCoverage.
 boolean hasMoreGridCoverages()
          Returns true until read has been called, as World Image files only support one GridCoverage.
 java.lang.String[] listSubNames()
          WorldImage GridCoverages are not named.
 org.opengis.coverage.grid.GridCoverage read(org.opengis.parameter.GeneralParameterValue[] parameters)
          Reads an image from a source stream.
 void skip()
          Not supported, does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorldImageReader

public WorldImageReader(java.lang.Object source)
Class constructor. Construct a new ImageWorldReader to read a GridCoverage from the source object. The source must point to the raster file itself, not the world file. If the source is a Java URL it checks if it is ponting to a file and if so it converts the url into a file.

Parameters:
source - The source of a GridCoverage, can be a File, a URL or an input stream.
Method Detail

getFormat

public org.opengis.coverage.grid.Format getFormat()
Returns the format that this Reader accepts.

Specified by:
getFormat in interface org.opengis.coverage.grid.GridCoverageReader
Returns:
a new WorldImageFormat class

getSource

public java.lang.Object getSource()
Returns the source object containing the GridCoverage. Note that it points to the raster, and not the world file.

Specified by:
getSource in interface org.opengis.coverage.grid.GridCoverageReader
Returns:
the source object containing the GridCoverage.

getMetadataNames

public java.lang.String[] getMetadataNames()
                                    throws java.io.IOException
Metadata is not suported. Returns null.

Specified by:
getMetadataNames in interface org.opengis.coverage.grid.GridCoverageReader
Returns:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

getMetadataValue

public java.lang.String getMetadataValue(java.lang.String name)
                                  throws java.io.IOException,
                                         org.opengis.coverage.MetadataNameNotFoundException
Metadata is not supported. Returns null.

Specified by:
getMetadataValue in interface org.opengis.coverage.grid.GridCoverageReader
Parameters:
name - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!
org.opengis.coverage.MetadataNameNotFoundException - DOCUMENT ME!

listSubNames

public java.lang.String[] listSubNames()
                                throws java.io.IOException
WorldImage GridCoverages are not named. Returns null.

Specified by:
listSubNames in interface org.opengis.coverage.grid.GridCoverageReader
Returns:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

getCurrentSubname

public java.lang.String getCurrentSubname()
                                   throws java.io.IOException
WorldImage GridCoverages are not named. Returns null.

Specified by:
getCurrentSubname in interface org.opengis.coverage.grid.GridCoverageReader
Returns:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

hasMoreGridCoverages

public boolean hasMoreGridCoverages()
                             throws java.io.IOException
Returns true until read has been called, as World Image files only support one GridCoverage.

Specified by:
hasMoreGridCoverages in interface org.opengis.coverage.grid.GridCoverageReader
Returns:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

read

public org.opengis.coverage.grid.GridCoverage read(org.opengis.parameter.GeneralParameterValue[] parameters)
                                            throws java.lang.IllegalArgumentException,
                                                   java.io.IOException
Reads an image from a source stream. Loads an image from a source stream, then loads the values from the world file and constructs a new GridCoverage from this information. When reading from a remote stream we do not look for a world fiel but we suppose those information comes from a different way (xml, gml, pigeon?)

Specified by:
read in interface org.opengis.coverage.grid.GridCoverageReader
Parameters:
parameters - WorldImageReader supports no parameters, it just ignores them.
Returns:
a new GridCoverage read from the source.
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!

skip

public void skip()
          throws java.io.IOException
Not supported, does nothing.

Specified by:
skip in interface org.opengis.coverage.grid.GridCoverageReader
Throws:
java.io.IOException - DOCUMENT ME!

dispose

public void dispose()
             throws java.io.IOException
Cleans up the Reader (currently does nothing)

Specified by:
dispose in interface org.opengis.coverage.grid.GridCoverageReader
Throws:
java.io.IOException - DOCUMENT ME!


Copyright © GeoTools. All Rights Reserved.