Class WorldImageReader

  • All Implemented Interfaces:
    GridCoverageReader, GridCoverage2DReader

    public final class WorldImageReader
    extends AbstractGridCoverage2DReader
    implements GridCoverage2DReader
    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).
    Author:
    simone giannecchini, alessio fabiani, rgould
    • Constructor Detail

      • WorldImageReader

        public WorldImageReader​(Object input)
                         throws DataSourceException
        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:
        input - The source of a GridCoverage, can be a File, a URL or an input stream.
        Throws:
        DataSourceException
      • WorldImageReader

        public WorldImageReader​(Object input,
                                Hints hints)
                         throws DataSourceException
        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:
        input - The source of a GridCoverage, can be a File, a URL or an input stream.
        Throws:
        DataSourceException
    • Method Detail

      • getFormat

        public Format getFormat()
        Returns the format that this Reader accepts.
        Specified by:
        getFormat in interface GridCoverageReader
        Returns:
        a new WorldImageFormat class
      • read

        public GridCoverage2D read​(GeneralParameterValue[] params)
                            throws IllegalArgumentException,
                                   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 GridCoverage2DReader
        Specified by:
        read in interface GridCoverageReader
        Specified by:
        read in class AbstractGridCoverage2DReader
        Parameters:
        params - WorldImageReader supports no parameters, it just ignores them.
        Returns:
        a new GridCoverage read from the 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.
        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
      • getExtension

        public String getExtension()
        Returns the file extension of the image.
        Since:
        2.7