org.geotoolkit.image.io
Class ImageReaderAdapter

Object
  extended by ImageReader
      extended by SpatialImageReader
          extended by ImageReaderAdapter
All Implemented Interfaces:
WarningProducer, Disposable, Localized
Direct Known Subclasses:
WorldFileImageReader

@Decorator(value=javax.imageio.ImageReader.class)
public abstract class ImageReaderAdapter
extends SpatialImageReader

Base class for readers which delegate most of their work to an other ImageReader. This is used for reusing an existing image reader while adding some extra functionalities, like adding geographic information in SpatialMetadata.

The wrapped image reader is called the main reader. The input given to that reader is determined by the createInput(String) method - it may or may not be the same input than the one given to this ImageReaderAdapter. Most methods like getWidth(int), getHeight(int) and read(int) delegate directly to the main reader.

The amount of methods declared in this class is large, but the only new methods are createInput(String) and initialize(). All other methods override existing methods declared in parent classes, mostly ImageReader and SpatialImageReader.

Subclasses typically need to implement of override the following methods only:


Example
The World File format is composed of a classical image file (usually with the ".tiff", ".jpg" or ".png" extension) together with a small text file containing geolocalization information (often with the ".tfw" extension) and an other small text file containing projection information (".prj" extension). This ImageReaderAdapter class can be used for wrapping a TIFF image reader, augmented with the parsing of TFW and PRJ files. The information fetched from those files are stored in the SpatialMetadata object returned by the getImageMetadata(int) method in this class. The createMetadata(int) protected method provides a convenient hook where to fill the metadata information.

Since:
3.07
Version:
3.19
Author:
Martin Desruisseaux (Geomatys)
See Also:
ImageWriterAdapter
Module:
coverage/geotk-coverageio (download)    View source code for this class

Nested Class Summary
static class ImageReaderAdapter.Spi
          Service provider interface (SPI) for ImageReaderAdapters.
 
Field Summary
protected  ImageReader main
          The reader to use for reading the pixel values.
 
Fields inherited from class ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
 
Fields inherited from interface WarningProducer
LOGGER
 
Constructor Summary
protected ImageReaderAdapter(ImageReaderAdapter.Spi provider)
          Constructs a new image reader.
protected ImageReaderAdapter(ImageReaderAdapter.Spi provider, ImageReader main)
          Constructs a new image reader wrapping the given reader.
 
Method Summary
 void abort()
          Requests that any current read operation be aborted.
 void addIIOReadProgressListener(IIOReadProgressListener listener)
          Adds the given listener to the list of registered progress listeners.
 void addIIOReadUpdateListener(IIOReadUpdateListener listener)
          Adds the given listener to the list of registered update listeners.
 void addIIOReadWarningListener(IIOReadWarningListener listener)
          Adds the given listener to the list of registered warning listeners.
 boolean canReadRaster()
          Returns true if this plug-in supports reading just a Raster of pixel data.
protected  void close()
          Closes the input stream created by createInput(String).
protected  Object createInput(String readerID)
          Creates the input to give to the main reader, or to an other reader identified by the readerID argument.
protected  SpatialMetadata createMetadata(int imageIndex)
          Creates a new stream or image metadata.
 void dispose()
          Allows any resources held by this object to be released.
protected  void finalize()
          Invokes the close() method when this reader is garbage-collected.
 float getAspectRatio(int imageIndex)
          Returns the aspect ratio of the given image.
 Locale[] getAvailableLocales()
          Returns the locales that may be used to localize warning listeners.
 SpatialImageReadParam getDefaultReadParam()
          Returns a default parameter object appropriate for this format.
 int getDimension(int imageIndex)
          Returns the number of dimension of the image at the given index.
 GridEnvelope getGridEnvelope(int imageIndex)
          Returns the grid range of the image at the given index.
 int getHeight(int imageIndex)
          Returns the height in pixels of the given image within the input source.
 SpatialMetadata getImageMetadata(int imageIndex)
          Returns metadata associated with the given image.
 Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
          Returns a collection of ImageTypeSpecifier containing possible image types to which the given image may be decoded.
 Locale getLocale()
          Returns the locale used to localize warning listeners.
 int getNumBands(int imageIndex)
          Returns the number of bands available for the specified image.
 int getNumImages(boolean allowSearch)
          Returns the number of images available from the current input source.
 int getNumThumbnails(int imageIndex)
          Returns the number of thumbnail preview images associated with the given image.
 ImageTypeSpecifier getRawImageType(int imageIndex)
          Returns an image type specifier indicating the SampleModel and ColorModel which most closely represents the "raw" internal format of the image.
 SpatialMetadata getStreamMetadata()
          Returns metadata associated with the input source as a whole.
 int getThumbnailHeight(int imageIndex, int thumbnailIndex)
          Returns the height of the thumbnail preview image associated to the given image.
 int getThumbnailWidth(int imageIndex, int thumbnailIndex)
          Returns the width of the thumbnail preview image associated to the given image.
 int getTileGridXOffset(int imageIndex)
          Returns the X coordinate of the upper-left corner of tile (0, 0) in the given image.
 int getTileGridYOffset(int imageIndex)
          Returns the Y coordinate of the upper-left corner of tile (0, 0) in the given image.
 int getTileHeight(int imageIndex)
          Returns the height of a tile in the given image.
 int getTileWidth(int imageIndex)
          Returns the width of a tile in the given image.
 int getWidth(int imageIndex)
          Returns the width in pixels of the given image within the input source.
 boolean hasColors(int imageIndex)
          Returns true if the image at the given index has a color palette.
 boolean hasThumbnails(int imageIndex)
          Returns true if the given image has thumbnail preview images associated with it.
protected  void initialize()
          Invoked automatically when the main reader has been given a new input.
 boolean isImageTiled(int imageIndex)
          Returns true if the image is organized into tiles, that is, equal-sized non-overlapping rectangles.
 boolean isRandomAccessEasy(int imageIndex)
          Returns true if the storage format of the given image places no inherent impediment on random access to pixels.
 BufferedImage read(int imageIndex)
          Reads the image indexed by imageIndex using a default ImageReadParam.
 BufferedImage read(int imageIndex, ImageReadParam param)
          Reads the image indexed by imageIndex using the given parameters.
 RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param)
          Reads the image indexed by imageIndex as a rendered image.
 boolean readerSupportsThumbnails()
          Returns true if the image format supports thumbnail preview images associated with it.
 Raster readRaster(int imageIndex, ImageReadParam param)
          Returns a new raster containing the raw pixel data from the image stream, without any color conversion applied.
 BufferedImage readThumbnail(int imageIndex, int thumbnailIndex)
          Returns the thumbnail preview image indexed by thumbnailIndex, associated with the given image.
 BufferedImage readTile(int imageIndex, int tileX, int tileY)
          Reads the tile indicated by the tileX and tileY arguments.
 Raster readTileRaster(int imageIndex, int tileX, int tileY)
          Reads the raster indicated by the tileX and tileY arguments, without any color conversion applied.
 void removeAllIIOReadProgressListeners()
          Removes all currently registered progress listeners.
 void removeAllIIOReadUpdateListeners()
          Removes all currently registered update listeners.
 void removeAllIIOReadWarningListeners()
          Removes all currently registered warning listeners.
 void removeIIOReadProgressListener(IIOReadProgressListener listener)
          Removes the given listener from the list of registered progress listeners.
 void removeIIOReadUpdateListener(IIOReadUpdateListener listener)
          Removes the given listener from the list of registered update listeners.
 void removeIIOReadWarningListener(IIOReadWarningListener listener)
          Removes the given listener from the list of registered warning listeners.
 void reset()
          Restores the ImageReader to its initial state.
 void setLocale(Locale locale)
          Sets the locale used to localize warning listeners.
 
Methods inherited from class SpatialImageReader
checkBandIndex, checkImageIndex, collapseNoDataValues, flipVertically, getDestination, getImageType, getRawDataType, setInput, warningOccurred
 
Methods inherited from class ImageReader
abortRequested, checkReadParamBandSettings, clearAbortRequest, computeRegions, getDestination, getFormatName, getImageMetadata, getInput, getMinIndex, getOriginatingProvider, getSourceRegion, getStreamMetadata, isIgnoringMetadata, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, readAll, readAll, setInput, setInput
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

main

protected final ImageReader main
The reader to use for reading the pixel values.

Constructor Detail

ImageReaderAdapter

protected ImageReaderAdapter(ImageReaderAdapter.Spi provider)
                      throws IOException
Constructs a new image reader. The provider argument is mandatory for this constructor. If the provider is unknown, use the next constructor below instead.

Parameters:
provider - The ImageReaderSpi that is constructing this object.
Throws:
IOException - If an error occurred while creating the main reader.

ImageReaderAdapter

protected ImageReaderAdapter(ImageReaderAdapter.Spi provider,
                             ImageReader main)
Constructs a new image reader wrapping the given reader.

Parameters:
provider - The ImageReaderSpi that is constructing this object, or null.
main - The reader to use for reading the pixel values.
Method Detail

createInput

protected Object createInput(String readerID)
                      throws IllegalStateException,
                             IOException
Creates the input to give to the main reader, or to an other reader identified by the readerID argument. The default ImageReaderAdapter implementation invokes this method with a readerID argument value equals to "main" when the main reader needs to be used for the first time. This may happen at any time after the setInput method has been invoked.

The only readerID argument value accepted by the default implementation is "main"; any other argument value causes a null value to be returned. However subclasses can override this method for supporting more reader types. The table below summarizes a few types supported by this reader and different subclasses:

Reader type Defined by Usage
 "main"   ImageReaderAdapter   The input to be given to the main reader. 
 "tfw"   WorldFileImageReader   The input for the World File
 "prj"   WorldFileImageReader   The input for the Map Projection file. 

The default implementation first checks if the main reader accepts directly the input of this reader. If so, then that input is returned with no change. Otherwise the input is wrapped in an ImageInputStream, which is returned. The input stream assigned to the main reader will be closed by the close() method.

Parameters:
readerID - Identifier of the reader for which an input is needed.
Returns:
The input to give to the identified reader, or null if this method can not create such input.
Throws:
IllegalStateException - if the input source has not been set.
IOException - If an error occurred while creating the input for the reader.
See Also:
ImageWriterAdapter.createOutput(String)

initialize

protected void initialize()
                   throws IOException
Invoked automatically when the main reader has been given a new input. When this method is invoked, the main reader input has already been set to the value returned by createInput("main").

The default implementation does nothing. Subclasses can override this method for performing additional initialization.

Throws:
IOException - If an error occurred while initializing the main reader.

getNumImages

public int getNumImages(boolean allowSearch)
                 throws IllegalStateException,
                        IOException
Returns the number of images available from the current input source. The default implementation ensures that the main reader has been initialized, then delegates to that reader.

Overrides:
getNumImages in class SpatialImageReader
Parameters:
allowSearch - If true, the number of images will be returned even if a search is required.
Returns:
The number of images, or -1 if allowSearch is false and a search would be required.
Throws:
IllegalStateException - if the input source has not been set.
IOException - if an error occurs reading the information from the input source.

getNumThumbnails

public int getNumThumbnails(int imageIndex)
                     throws IllegalStateException,
                            IOException
Returns the number of thumbnail preview images associated with the given image. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getNumThumbnails in class ImageReader
Throws:
IllegalStateException
IOException
See Also:
hasThumbnails(int)

getNumBands

public int getNumBands(int imageIndex)
                throws IOException
Returns the number of bands available for the specified image. The default implementation delegates to the main reader if it is an instance of SpatialImageReader, or returns the number of bands of the raw image type otherwise.

Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getNumBands in class SpatialImageReader
Parameters:
imageIndex - The image index.
Returns:
The number of bands available for the specified image.
Throws:
IOException - if an error occurs reading the information from the input source.

getDimension

public int getDimension(int imageIndex)
                 throws IOException
Returns the number of dimension of the image at the given index. The default implementation delegates to the main reader if it is an instance of SpatialImageReader, or returns 2 otherwise.

Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getDimension in class SpatialImageReader
Parameters:
imageIndex - The image index.
Returns:
The number of dimension for the image at the given index.
Throws:
IOException - if an error occurs reading the information from the input source.
See Also:
MultidimensionalImageStore

getGridEnvelope

public GridEnvelope getGridEnvelope(int imageIndex)
                             throws IOException
Returns the grid range of the image at the given index. The default implementation delegates to the main reader if it is an instance of SpatialImageReader, or to the super-class otherwise.

Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getGridEnvelope in class SpatialImageReader
Parameters:
imageIndex - The image index.
Returns:
The grid envelope for the image at the given index.
Throws:
IOException - if an error occurs reading the information from the input source.
Since:
3.19
See Also:
MultidimensionalImageStore

getAspectRatio

public float getAspectRatio(int imageIndex)
                     throws IOException
Returns the aspect ratio of the given image. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getAspectRatio in class ImageReader
Throws:
IOException
See Also:
getWidth(int), getHeight(int)

getWidth

public int getWidth(int imageIndex)
             throws IOException
Returns the width in pixels of the given image within the input source. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Specified by:
getWidth in class ImageReader
Throws:
IOException
See Also:
getTileWidth(int), getThumbnailWidth(int, int)

getHeight

public int getHeight(int imageIndex)
              throws IOException
Returns the height in pixels of the given image within the input source. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Specified by:
getHeight in class ImageReader
Throws:
IOException
See Also:
getTileHeight(int), getThumbnailHeight(int, int)

getTileWidth

public int getTileWidth(int imageIndex)
                 throws IOException
Returns the width of a tile in the given image. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getTileWidth in class ImageReader
Throws:
IOException
See Also:
isImageTiled(int), getTileGridXOffset(int)

getTileHeight

public int getTileHeight(int imageIndex)
                  throws IOException
Returns the height of a tile in the given image. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getTileHeight in class ImageReader
Throws:
IOException
See Also:
isImageTiled(int), getTileGridYOffset(int)

getTileGridXOffset

public int getTileGridXOffset(int imageIndex)
                       throws IOException
Returns the X coordinate of the upper-left corner of tile (0, 0) in the given image. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getTileGridXOffset in class ImageReader
Throws:
IOException
See Also:
isImageTiled(int)

getTileGridYOffset

public int getTileGridYOffset(int imageIndex)
                       throws IOException
Returns the Y coordinate of the upper-left corner of tile (0, 0) in the given image. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getTileGridYOffset in class ImageReader
Throws:
IOException
See Also:
isImageTiled(int)

getThumbnailWidth

public int getThumbnailWidth(int imageIndex,
                             int thumbnailIndex)
                      throws IOException
Returns the width of the thumbnail preview image associated to the given image. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getThumbnailWidth in class ImageReader
Throws:
IOException
See Also:
hasThumbnails(int), getNumThumbnails(int)

getThumbnailHeight

public int getThumbnailHeight(int imageIndex,
                              int thumbnailIndex)
                       throws IOException
Returns the height of the thumbnail preview image associated to the given image. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getThumbnailHeight in class ImageReader
Throws:
IOException
See Also:
hasThumbnails(int), getNumThumbnails(int)

hasThumbnails

public boolean hasThumbnails(int imageIndex)
                      throws IOException
Returns true if the given image has thumbnail preview images associated with it. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
hasThumbnails in class ImageReader
Throws:
IOException
See Also:
getNumThumbnails(int), readerSupportsThumbnails(), getThumbnailWidth(int, int), getThumbnailHeight(int, int)

isImageTiled

public boolean isImageTiled(int imageIndex)
                     throws IOException
Returns true if the image is organized into tiles, that is, equal-sized non-overlapping rectangles. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
isImageTiled in class ImageReader
Throws:
IOException
See Also:
getTileWidth(int), getTileHeight(int), getTileGridXOffset(int), getTileGridYOffset(int)

isRandomAccessEasy

public boolean isRandomAccessEasy(int imageIndex)
                           throws IOException
Returns true if the storage format of the given image places no inherent impediment on random access to pixels. The default implementation delegates to the main reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
isRandomAccessEasy in class ImageReader
Throws:
IOException

getStreamMetadata

public SpatialMetadata getStreamMetadata()
                                  throws IOException
Returns metadata associated with the input source as a whole. The default implementation ensures that the main reader is initialized, then delegates to the createMetadata(int) method as documented in the super-class method.

Subclasses should consider overriding the createMetadata(int) method instead than this one.

Overrides:
getStreamMetadata in class SpatialImageReader
Returns:
The metadata, or null if none.
Throws:
IOException - if an error occurs during reading.

getImageMetadata

public SpatialMetadata getImageMetadata(int imageIndex)
                                 throws IOException
Returns metadata associated with the given image. The default implementation ensures (indirectly, though a call to getNumImages(boolean)) that the main reader is initialized, then delegates to the createMetadata(int) method as documented in the super-class method.

Subclasses should consider overriding the createMetadata(int) method instead than this one.

Overrides:
getImageMetadata in class SpatialImageReader
Parameters:
imageIndex - The image index.
Returns:
The metadata, or null if none.
Throws:
IOException - if an error occurs during reading.

createMetadata

protected SpatialMetadata createMetadata(int imageIndex)
                                  throws IOException
Creates a new stream or image metadata. This method is invoked by the public getStreamMetadata() and getImageMetadata(int) methods. The default implementation delegates to the corresponding method of the main reader. Then there is a choice:

Overrides:
createMetadata in class SpatialImageReader
Parameters:
imageIndex - -1 for stream metadata, or the image index for image metadata.
Returns:
The requested metadata, or null if none.
Throws:
IOException - If an error occurred while reading metadata.

hasColors

public boolean hasColors(int imageIndex)
                  throws IOException
Returns true if the image at the given index has a color palette. The default implementation delegates to the main reader if it is an instance of SpatialImageReader, or returns true otherwise (on the assumption that the wrapped reader is for some standard format like PNG).

Overrides:
hasColors in class SpatialImageReader
Parameters:
imageIndex - The index of the image to be queried.
Returns:
true if the image at the given index has a color palette.
Throws:
IOException - If an error occurs reading the information from the input source.
Since:
3.11
See Also:
SpatialImageReadParam.setPaletteName(String)

getImageTypes

public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
                                           throws IOException
Returns a collection of ImageTypeSpecifier containing possible image types to which the given image may be decoded. The default implementation delegates to the main image reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getImageTypes in class SpatialImageReader
Parameters:
imageIndex - The index of the image to be queried.
Returns:
A set of suggested image types for decoding the current given image.
Throws:
IOException - If an error occurs reading the format information from the input source.

getRawImageType

public ImageTypeSpecifier getRawImageType(int imageIndex)
                                   throws IOException
Returns an image type specifier indicating the SampleModel and ColorModel which most closely represents the "raw" internal format of the image. The default implementation delegates to the main image reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
getRawImageType in class SpatialImageReader
Parameters:
imageIndex - The index of the image to be queried.
Returns:
The image type (never null).
Throws:
IOException - If an error occurs reading the format information from the input source.
See Also:
SpatialImageReader.getImageType(int, ImageReadParam, SampleConverter[]), SpatialImageReader.getDefaultReadParam()

getDefaultReadParam

public SpatialImageReadParam getDefaultReadParam()
Returns a default parameter object appropriate for this format.

Overrides:
getDefaultReadParam in class SpatialImageReader
Returns:
An ImageReadParam object which may be used.

read

public BufferedImage read(int imageIndex)
                   throws IOException
Reads the image indexed by imageIndex using a default ImageReadParam. The default implementation delegates to the main image reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
read in class ImageReader
Throws:
IOException

read

public BufferedImage read(int imageIndex,
                          ImageReadParam param)
                   throws IOException
Reads the image indexed by imageIndex using the given parameters. The default implementation delegates to the main image reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Specified by:
read in class ImageReader
Throws:
IOException

readAsRenderedImage

public RenderedImage readAsRenderedImage(int imageIndex,
                                         ImageReadParam param)
                                  throws IOException
Reads the image indexed by imageIndex as a rendered image. The default implementation delegates to the main image reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
readAsRenderedImage in class ImageReader
Throws:
IOException

readTile

public BufferedImage readTile(int imageIndex,
                              int tileX,
                              int tileY)
                       throws IOException
Reads the tile indicated by the tileX and tileY arguments. The default implementation delegates to the main image reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
readTile in class ImageReader
Throws:
IOException
See Also:
isImageTiled(int)

readRaster

public Raster readRaster(int imageIndex,
                         ImageReadParam param)
                  throws IOException
Returns a new raster containing the raw pixel data from the image stream, without any color conversion applied. The default implementation delegates to the main image reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
readRaster in class ImageReader
Throws:
IOException
See Also:
canReadRaster()

readTileRaster

public Raster readTileRaster(int imageIndex,
                             int tileX,
                             int tileY)
                      throws IOException
Reads the raster indicated by the tileX and tileY arguments, without any color conversion applied. The default implementation delegates to the main image reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
readTileRaster in class ImageReader
Throws:
IOException
See Also:
isImageTiled(int), canReadRaster()

readThumbnail

public BufferedImage readThumbnail(int imageIndex,
                                   int thumbnailIndex)
                            throws IOException
Returns the thumbnail preview image indexed by thumbnailIndex, associated with the given image. The default implementation delegates to the main image reader. Note that the main reader is indirectly initialized by an implicit call to getNumImages(boolean).

Overrides:
readThumbnail in class ImageReader
Throws:
IOException
See Also:
hasThumbnails(int)

readerSupportsThumbnails

public boolean readerSupportsThumbnails()
Returns true if the image format supports thumbnail preview images associated with it. The default implementation delegates to the main reader. No input needs to be set for this method.

Overrides:
readerSupportsThumbnails in class ImageReader
See Also:
hasThumbnails(int)

canReadRaster

public boolean canReadRaster()
Returns true if this plug-in supports reading just a Raster of pixel data. The default implementation delegates to the main reader. No input needs to be set for this method.

Overrides:
canReadRaster in class ImageReader

getAvailableLocales

public Locale[] getAvailableLocales()
Returns the locales that may be used to localize warning listeners. The default implementation delegates to the main reader. No input needs to be set for this method.

Overrides:
getAvailableLocales in class ImageReader

getLocale

public Locale getLocale()
Returns the locale used to localize warning listeners. The default implementation delegates to the main reader. No input needs to be set for this method.

Specified by:
getLocale in interface Localized
Overrides:
getLocale in class ImageReader
Returns:
The locale, or null if not explicitly defined.

setLocale

public void setLocale(Locale locale)
Sets the locale used to localize warning listeners. The default implementation delegates to the main reader. No input needs to be set for this method.

Overrides:
setLocale in class ImageReader

addIIOReadWarningListener

public void addIIOReadWarningListener(IIOReadWarningListener listener)
Adds the given listener to the list of registered warning listeners. Thie listener is added both to this reader and to the main reader.

Overrides:
addIIOReadWarningListener in class ImageReader

removeIIOReadWarningListener

public void removeIIOReadWarningListener(IIOReadWarningListener listener)
Removes the given listener from the list of registered warning listeners.

Overrides:
removeIIOReadWarningListener in class ImageReader

removeAllIIOReadWarningListeners

public void removeAllIIOReadWarningListeners()
Removes all currently registered warning listeners.

Overrides:
removeAllIIOReadWarningListeners in class ImageReader

addIIOReadProgressListener

public void addIIOReadProgressListener(IIOReadProgressListener listener)
Adds the given listener to the list of registered progress listeners. This method adds the listener only to the main reader, not to this reader, in order to ensure that progress methods are invoked only once.

Overrides:
addIIOReadProgressListener in class ImageReader

removeIIOReadProgressListener

public void removeIIOReadProgressListener(IIOReadProgressListener listener)
Removes the given listener from the list of registered progress listeners.

Overrides:
removeIIOReadProgressListener in class ImageReader

removeAllIIOReadProgressListeners

public void removeAllIIOReadProgressListeners()
Removes all currently registered progress listeners.

Overrides:
removeAllIIOReadProgressListeners in class ImageReader

addIIOReadUpdateListener

public void addIIOReadUpdateListener(IIOReadUpdateListener listener)
Adds the given listener to the list of registered update listeners. This method adds the listener only to the main reader, not to this reader, in order to ensure that update methods are invoked only once.

Overrides:
addIIOReadUpdateListener in class ImageReader

removeIIOReadUpdateListener

public void removeIIOReadUpdateListener(IIOReadUpdateListener listener)
Removes the given listener from the list of registered update listeners.

Overrides:
removeIIOReadUpdateListener in class ImageReader

removeAllIIOReadUpdateListeners

public void removeAllIIOReadUpdateListeners()
Removes all currently registered update listeners.

Overrides:
removeAllIIOReadUpdateListeners in class ImageReader

abort

public void abort()
Requests that any current read operation be aborted. The default implementation delegates to both the main reader and to the super-class method.

Overrides:
abort in class ImageReader

reset

public void reset()
Restores the ImageReader to its initial state. The default implementation delegates to both the main reader and to the super-class method.

Overrides:
reset in class ImageReader

dispose

public void dispose()
Allows any resources held by this object to be released. The default implementation delegates to both the main reader and to the super-class method.

Specified by:
dispose in interface Disposable
Overrides:
dispose in class SpatialImageReader

close

protected void close()
              throws IOException
Closes the input stream created by createInput(String). This method does nothing if the input used by the main reader is the one given by the user to the setInput method. Otherwise, if the input of the main reader is an instance of ImageInputStream or Closeable, then it is closed.

This method is invoked automatically by setInput(...), reset(), dispose() or finalize() methods and doesn't need to be invoked explicitly. It has protected access only in order to allow overriding by subclasses. Overriding methods shall make sure that super.close() is invoked even in case of failure.

Overrides:
close in class SpatialImageReader
Throws:
IOException - if an error occurred while closing the stream.

finalize

protected void finalize()
                 throws Throwable
Invokes the close() method when this reader is garbage-collected. Note that this will actually close the stream only if it has been created by this reader, rather than supplied by the user.

Overrides:
finalize in class Object
Throws:
Throwable


Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.