FileDocCategorySizeDatePackage
ImageReader.javaAPI DocAndroid 1.5 API37907Wed May 06 22:41:54 BST 2009javax.imageio

ImageReader

public abstract class ImageReader extends Object
The ImageReader class is an abstract class for decoding images. ImageReader objects are instantiated by the service provider interface, ImageReaderSpi class, for the specific format. ImageReaderSpi class should be registered with the IIORegistry, which uses them for format recognition and presentation of available format readers and writers.
since
Android 1.0

Fields Summary
protected ImageReaderSpi
originatingProvider
The originating provider.
protected Object
input
The input object such as ImageInputStream.
protected boolean
seekForwardOnly
The seek forward only.
protected boolean
ignoreMetadata
The ignore metadata flag indicates whether current input source has been marked as metadata is allowed to be ignored by setInput.
protected int
minIndex
The minimum index.
protected Locale[]
availableLocales
The available locales.
protected Locale
locale
The locale.
protected List
warningListeners
The list of warning listeners.
protected List
warningLocales
The list of warning locales.
protected List
progressListeners
The list of progress listeners.
protected List
updateListeners
The list of update listeners.
Constructors Summary
protected ImageReader(ImageReaderSpi originatingProvider)
Instantiates a new ImageReader.

param
originatingProvider the ImageReaderSpi which instantiates this ImageReader.

        this.originatingProvider = originatingProvider;
    
Methods Summary
public voidabort()
Requests an abort operation for current reading operation.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected booleanabortRequested()
Checks whether or not a request to abort the current read operation has been made successfully.

return
true, if the request to abort the current read operation has been made successfully, false otherwise.

        throw new UnsupportedOperationException("Not implemented yet");
    
public voidaddIIOReadProgressListener(javax.imageio.event.IIOReadProgressListener listener)
Adds the IIOReadProgressListener.

param
listener the IIOReadProgressListener.

        throw new UnsupportedOperationException("Not implemented yet");
    
public voidaddIIOReadUpdateListener(javax.imageio.event.IIOReadUpdateListener listener)
Adds the IIOReadUpdateListener.

param
listener the IIOReadUpdateListener.

        throw new UnsupportedOperationException("Not implemented yet");
    
public voidaddIIOReadWarningListener(javax.imageio.event.IIOReadWarningListener listener)
Adds the IIOReadWarningListener.

param
listener the IIOReadWarningListener.

        throw new UnsupportedOperationException("Not implemented yet");
    
public booleancanReadRaster()
Checks whether or not this plug-in supports reading a Raster.

return
true, if this plug-in supports reading a Raster, false otherwise.

        return false; // def
    
protected static voidcheckReadParamBandSettings(javax.imageio.ImageReadParam param, int numSrcBands, int numDstBands)
Checks the validity of the source and destination band and is called when the reader knows the number of bands of the source image and the number of bands of the destination image.

param
param the ImageReadParam for reading the Image.
param
numSrcBands the number of bands in the source.
param
numDstBands the number of bands in the destination.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidclearAbortRequest()
Clears all previous abort request, and abortRequested returns false after calling this method.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected static voidcomputeRegions(javax.imageio.ImageReadParam param, int srcWidth, int srcHeight, java.awt.image.BufferedImage image, java.awt.Rectangle srcRegion, java.awt.Rectangle destRegion)
Computes the specified source region and the specified destination region with the specified the width and height of the source image, an optional destination image, and an ImageReadParam.

param
param the an ImageReadParam object, or null.
param
srcWidth the source image's width.
param
srcHeight the source image's height.
param
image the destination image.
param
srcRegion the source region.
param
destRegion the destination region.

        throw new UnsupportedOperationException("Not implemented yet");
    
public voiddispose()
Disposes of any resources.

        // do nothing by def
    
public floatgetAspectRatio(int imageIndex)
Gets the aspect ratio (width devided by height) of the image.

param
imageIndex the image index.
return
the aspect ratio of the image.
throws
IOException if an I/O exception has occurred.

        return (float)getWidth(imageIndex) / getHeight(imageIndex);
    
public java.util.Locale[]getAvailableLocales()
Gets the available locales.

return
an array of the available locales.

        return availableLocales;
    
public javax.imageio.ImageReadParamgetDefaultReadParam()
Gets the default ImageReadParam object.

return
the ImageReadParam object.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected static java.awt.image.BufferedImagegetDestination(javax.imageio.ImageReadParam param, java.util.Iterator imageTypes, int width, int height)
Gets the destination image where the decoded data is written.

param
param the ImageReadParam.
param
imageTypes the iterator of ImageTypeSpecifier objects.
param
width the width of the image being decoded.
param
height the height of the image being decoded.
return
the BufferedImage where decoded pixels should be written.
throws
IIOException the IIOException is thrown if there is no suitable ImageTypeSpecifier.

        throw new UnsupportedOperationException("Not implemented yet");
    
public java.lang.StringgetFormatName()
Gets the format name of this input source.

return
the format name of this input source.
throws
IOException if an I/O exception has occurred.

        return originatingProvider.getFormatNames()[0];
    
public abstract intgetHeight(int imageIndex)
Gets the height of the specified image in input source.

param
imageIndex the image index.
return
the height in pixels.
throws
IOException if an I/O exception has occurred.

public abstract javax.imageio.metadata.IIOMetadatagetImageMetadata(int imageIndex)
Gets the image metadata of the specified image in input source.

param
imageIndex the image index.
return
the IIOMetadata.
throws
IOException if an I/O exception has occurred.

public javax.imageio.metadata.IIOMetadatagetImageMetadata(int imageIndex, java.lang.String formatName, java.util.Set nodeNames)
Gets the image metadata of the specified image input source.

param
imageIndex the image index.
param
formatName the desired metadata format to be used in the returned IIOMetadata object.
param
nodeNames the node names which can be contained in the document.
return
the IIOMetadata.
throws
IOException if an I/O exception has occurred.

        throw new UnsupportedOperationException("Not implemented yet");
    
public abstract java.util.IteratorgetImageTypes(int imageIndex)
Gets an Iterator of ImageTypeSpecifier objects which are associated with image types that may be used when decoding specified image.

param
imageIndex the image index.
return
an Iterator of ImageTypeSpecifier objects.
throws
IOException if an I/O exception has occurred.

public java.lang.ObjectgetInput()
Gets the input source object of this ImageReader, or returns null.

return
the input source object such as ImageInputStream, or null.

        return input;
    
public java.util.LocalegetLocale()
Gets the locale of this ImageReader.

return
the locale of this ImageReader.

        return locale;
    
public intgetMinIndex()
Gets the minimum valid index for reading an image, thumbnail, or image metadata.

return
the minimum valid index for reading an image, thumbnail, or image metadata.

        return minIndex;
    
public abstract intgetNumImages(boolean allowSearch)
Gets the number of images available in the current input source.

param
allowSearch the parameter which indicates what a search is required; if false, the reader may return -1 without searching.
return
the number of images.
throws
IOException if an I/O exception has occurred.

public intgetNumThumbnails(int imageIndex)
Gets the number of thumbnails for the specified image.

param
imageIndex the image's index.
return
the number of thumbnails.
throws
IOException if an I/O exception has occurred.

        return 0; // def
    
public javax.imageio.spi.ImageReaderSpigetOriginatingProvider()
Gets the ImageReaderSpi which instantiated this ImageReader.

return
the ImageReaderSpi.

        return originatingProvider;
    
public javax.imageio.ImageTypeSpecifiergetRawImageType(int imageIndex)
Gets an ImageTypeSpecifier which indicates the type of the specified image.

param
imageIndex the image's index.
return
the ImageTypeSpecifier.
throws
IOException if an I/O exception has occurred.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected static java.awt.RectanglegetSourceRegion(javax.imageio.ImageReadParam param, int srcWidth, int srcHeight)
Gets the region of source image that should be read with the specified width, height and ImageReadParam.

param
param the ImageReadParam object, or null.
param
srcWidth the source image's width.
param
srcHeight the source image's height.
return
the Rectangle of source region.

        throw new UnsupportedOperationException("Not implemented yet");
    
public abstract javax.imageio.metadata.IIOMetadatagetStreamMetadata()
Gets an IIOMetadata object for this input source.

return
the IIOMetadata.
throws
IOException if an I/O exception has occurred.

public javax.imageio.metadata.IIOMetadatagetStreamMetadata(java.lang.String formatName, java.util.Set nodeNames)
Gets an IIOMetadata object for this input source.

param
formatName the desired metadata format to be used in the returned IIOMetadata object.
param
nodeNames the node names of the document.
return
the IIOMetadata.
throws
IOException if an I/O exception has occurred.

        throw new UnsupportedOperationException("Not implemented yet");
    
public intgetThumbnailHeight(int imageIndex, int thumbnailIndex)
Gets the height of the specified thumbnail for the specified image.

param
imageIndex the image's index.
param
thumbnailIndex the thumbnail's index.
return
the thumbnail height.
throws
IOException if an I/O exception has occurred.

        return readThumbnail(imageIndex, thumbnailIndex).getHeight(); // def
    
public intgetThumbnailWidth(int imageIndex, int thumbnailIndex)
Gets the width of the specified thumbnail for the specified image.

param
imageIndex the image's index.
param
thumbnailIndex the thumbnail's index.
return
the thumbnail width.
throws
IOException if an I/O exception has occurred.

        return readThumbnail(imageIndex, thumbnailIndex).getWidth(); // def
    
public intgetTileGridXOffset(int imageIndex)
Gets the X coordinate of the upper left corner of the tile grid in the specified image.

param
imageIndex the image's index.
return
the X coordinate of the upper left corner of the tile grid.
throws
IOException if an I/O exception has occurred.

        return 0; // def
    
public intgetTileGridYOffset(int imageIndex)
Gets the Y coordinate of the upper left corner of the tile grid in the specified image.

param
imageIndex the image's index.
return
the Y coordinate of the upper left corner of the tile grid.
throws
IOException if an I/O exception has occurred.

        return 0; // def
    
public intgetTileHeight(int imageIndex)
Gets the tile height in the specified image.

param
imageIndex the image's index.
return
the tile height.
throws
IOException if an I/O exception has occurred.

        return getHeight(imageIndex); // def
    
public intgetTileWidth(int imageIndex)
Gets the tile width in the specified image.

param
imageIndex the image's index.
return
the tile width.
throws
IOException if an I/O exception has occurred.

        return getWidth(imageIndex); // def
    
public abstract intgetWidth(int imageIndex)
Gets the width of the specified image in input source.

param
imageIndex the image index.
return
the width in pixels.
throws
IOException if an I/O exception has occurred.

public booleanhasThumbnails(int imageIndex)
Checks if the specified image has thumbnails or not.

param
imageIndex the image's index.
return
true, if the specified image has thumbnails, false otherwise.
throws
IOException if an I/O exception has occurred.

        return getNumThumbnails(imageIndex) > 0; // def
    
public booleanisIgnoringMetadata()
Returns true if the current input source allows to metadata to be ignored by passing true as the ignoreMetadata argument to the setInput method.

return
true, if the current input source allows to metadata to be ignored by passing true as the ignoreMetadata argument to the setInput method.

        return ignoreMetadata;
    
public booleanisImageTiled(int imageIndex)
Checks if the specified image has tiles or not.

param
imageIndex the image's index.
return
true, if the specified image has tiles, false otherwise.
throws
IOException if an I/O exception has occurred.

        return false; // def
    
public booleanisRandomAccessEasy(int imageIndex)
Checks if the storage format of the specified image places an impediment on random pixels access or not.

param
imageIndex the image's index.
return
true, if the storage format of the specified image places an impediment on random pixels access, false otherwise.
throws
IOException if an I/O exception has occurred.

        return false; // def
    
public booleanisSeekForwardOnly()
Checks if the input source supports only forward reading, or not.

return
true, if the input source supports only forward reading, false otherwise.

        return seekForwardOnly;
    
private booleanisSupported(java.lang.Object input)
Checks if is supported.

param
input the input.
return
true, if is supported.

        ImageReaderSpi spi = getOriginatingProvider();
        if (null != spi) {
            Class[] outTypes = spi.getInputTypes();
            for (Class<?> element : outTypes) {
                if (element.isInstance(input)) {
                    return true;
                }
            }
        }
        return false;
    
protected voidprocessImageComplete()
Processes image completion by calling the imageComplete method on all registered IIOReadProgressListeners.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessImageProgress(float percentageDone)
Processes the current percentage of image completion by calling the imageProgress method on all registered IIOReadProgressListeners.

param
percentageDone the percentage done.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessImageStarted(int imageIndex)
Processes the start of an image read by calling the imageStarted method on all registered IIOReadProgressListeners.

param
imageIndex the image index.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessImageUpdate(java.awt.image.BufferedImage theImage, int minX, int minY, int width, int height, int periodX, int periodY, int[] bands)
Processes the update of a set of samples by calling the imageUpdate method on all registered IIOReadUpdateListeners.

param
theImage the image to be updated.
param
minX the X coordinate of the upper left pixel.
param
minY the Y coordinate of the upper left pixel.
param
width the width of updated area.
param
height the height of updated area.
param
periodX the horizontal separation between pixels.
param
periodY the vertical separation between pixels.
param
bands the number of affected bands.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessPassComplete(java.awt.image.BufferedImage theImage)
Processes the end of a progressive pass by calling passComplete method of registered IIOReadUpdateListeners.

param
theImage the image to be updated.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessPassStarted(java.awt.image.BufferedImage theImage, int pass, int minPass, int maxPass, int minX, int minY, int periodX, int periodY, int[] bands)
Processes the beginning of a progressive pass by calling the passStarted method on all registered IIOReadUpdateListeners.

param
theImage the image to be updated.
param
pass the current pass index.
param
minPass the minimum pass index.
param
maxPass the maximum pass index.
param
minX the X coordinate of of the upper left pixel.
param
minY the Y coordinate of of the upper left pixel.
param
periodX the horizontal separation between pixels.
param
periodY the vertical separation between pixels.
param
bands the number of affected bands.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessReadAborted()
Processes a read aborted event by calling the readAborted method on all registered IIOReadProgressListeners.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessSequenceComplete()
Processes the completion of an sequence of image reads by calling sequenceComplete method on all registered IIOReadProgressListeners.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessSequenceStarted(int minIndex)
Processes the start of an sequence of image reads by calling the sequenceStarted method on all registered IIOReadProgressListeners.

param
minIndex the minimum index.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessThumbnailComplete()
Processes the completion of a thumbnail read by calling the thumbnailComplete method on all registered IIOReadProgressListeners.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessThumbnailPassComplete(java.awt.image.BufferedImage theThumbnail)
Processes the end of a thumbnail progressive pass by calling the thumbnailPassComplete method on all registered IIOReadUpdateListeners.

param
theThumbnail the thumbnail to be updated.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessThumbnailPassStarted(java.awt.image.BufferedImage theThumbnail, int pass, int minPass, int maxPass, int minX, int minY, int periodX, int periodY, int[] bands)
Processes the beginning of a thumbnail progressive pass by calling the thumbnailPassStarted method on all registered IIOReadUpdateListeners.

param
theThumbnail the thumbnail to be updated.
param
pass the current pass index.
param
minPass the minimum pass index.
param
maxPass the maximum pass index.
param
minX the X coordinate of the upper left pixel.
param
minY the Y coordinate of the upper left pixel.
param
periodX the horizontal separation between pixels.
param
periodY the vertical separation between pixels.
param
bands the number of affected bands.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessThumbnailProgress(float percentageDone)
Processes the current percentage of thumbnail completion by calling the thumbnailProgress method on all registered IIOReadProgressListeners.

param
percentageDone the percentage done.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessThumbnailStarted(int imageIndex, int thumbnailIndex)
Processes the start of a thumbnail read by calling the thumbnailStarted method on all registered IIOReadProgressListeners.

param
imageIndex the image index.
param
thumbnailIndex the thumbnail index.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessThumbnailUpdate(java.awt.image.BufferedImage theThumbnail, int minX, int minY, int width, int height, int periodX, int periodY, int[] bands)
Processes the update of a set of samples in a thumbnail image by calling the thumbnailUpdate method on all registered IIOReadUpdateListeners.

param
theThumbnail the thumbnail to be updated.
param
minX the X coordinate of the upper left pixel.
param
minY the Y coordinate of the upper left pixel.
param
width the total width of the updated area.
param
height the total height of the updated area.
param
periodX the horizontal separation between pixels.
param
periodY the vertical separation between pixels.
param
bands the number of affected bands.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessWarningOccurred(java.lang.String warning)
Processes a warning message by calling warningOccurred method of registered IIOReadWarningListeners.

param
warning the warning.

        throw new UnsupportedOperationException("Not implemented yet");
    
protected voidprocessWarningOccurred(java.lang.String baseName, java.lang.String keyword)
Processes a warning by calling the warningOccurred method of on all registered IIOReadWarningListeners.

param
baseName the base name of ResourceBundles.
param
keyword the keyword to index the warning among ResourceBundles.

        throw new UnsupportedOperationException("Not implemented yet");
    
public java.awt.image.BufferedImageread(int imageIndex)
Reads the specified image and returns it as a BufferedImage using the default ImageReadParam.

param
imageIndex the image index.
return
the BufferedImage.
throws
IOException if an I/O exception has occurred.

        return read(imageIndex, null);
    
public abstract java.awt.image.BufferedImageread(int imageIndex, javax.imageio.ImageReadParam param)
Reads the specified image and returns it as a BufferedImage using the specified ImageReadParam.

param
imageIndex the image index.
param
param the ImageReadParam.
return
the BufferedImage.
throws
IOException if an I/O exception has occurred.

public javax.imageio.IIOImagereadAll(int imageIndex, javax.imageio.ImageReadParam param)
Reads the specified image and returns an IIOImage with this image, thumbnails, and metadata for this image, using the specified ImageReadParam.

param
imageIndex the image index.
param
param the ImageReadParam.
return
the IIOImage.
throws
IOException if an I/O exception has occurred.

        throw new UnsupportedOperationException("Not implemented yet");
    
public java.util.IteratorreadAll(java.util.Iterator params)
Returns an Iterator of IIOImages from the input source.

param
params the Iterator of ImageReadParam objects.
return
the iterator of IIOImages.
throws
IOException if an I/O exception has occurred.

        throw new UnsupportedOperationException("Not implemented yet");
    
public java.awt.image.RenderedImagereadAsRenderedImage(int imageIndex, javax.imageio.ImageReadParam param)
Reads the specified image using the specified ImageReadParam and returns it as a RenderedImage.

param
imageIndex the image index.
param
param the ImageReadParam.
return
the RenderedImage.
throws
IOException if an I/O exception has occurred.

        return read(imageIndex, param);
    
public java.awt.image.RasterreadRaster(int imageIndex, javax.imageio.ImageReadParam param)
Reads a new Raster object which contains the raw pixel data from the image.

param
imageIndex the image index.
param
param the ImageReadParam.
return
the Raster.
throws
IOException if an I/O exception has occurred.

        throw new UnsupportedOperationException("Unsupported");
    
public java.awt.image.BufferedImagereadThumbnail(int imageIndex, int thumbnailIndex)
Reads the thumbnail image for the specified image as a BufferedImage.

param
imageIndex the image index.
param
thumbnailIndex the thumbnail index.
return
the BufferedImage.
throws
IOException if an I/O exception has occurred.

        throw new UnsupportedOperationException("Unsupported"); // def
    
public java.awt.image.BufferedImagereadTile(int imageIndex, int tileX, int tileY)
Reads the tile specified by the tileX and tileY parameters of the specified image and returns it as a BufferedImage.

param
imageIndex the image index.
param
tileX the X index of tile.
param
tileY the Y index of tile.
return
the BufferedImage.
throws
IOException if an I/O exception has occurred.

        throw new UnsupportedOperationException("Not implemented yet");
    
public java.awt.image.RasterreadTileRaster(int imageIndex, int tileX, int tileY)
Reads the tile specified by the tileX and tileY parameters of the specified image and returns it as a Raster.

param
imageIndex the image index.
param
tileX the X index of tile.
param
tileY the Y index of tile.
return
the Raster.
throws
IOException if an I/O exception has occurred.

        throw new UnsupportedOperationException("Not implemented yet");
    
public booleanreaderSupportsThumbnails()
Returns true if the image format supported by this reader supports thumbnail preview images.

return
true, if the image format supported by this reader supports thumbnail preview images, false otherwise.

        return false; // def
    
public voidremoveAllIIOReadProgressListeners()
Removes registered IIOReadProgressListeners.

        throw new UnsupportedOperationException("Not implemented yet");
    
public voidremoveAllIIOReadUpdateListeners()
Removes registered IIOReadUpdateListeners.

        throw new UnsupportedOperationException("Not implemented yet");
    
public voidremoveAllIIOReadWarningListeners()
Removes all registered IIOReadWarningListeners.

        throw new UnsupportedOperationException("Not implemented yet");
    
public voidremoveIIOReadProgressListener(javax.imageio.event.IIOReadProgressListener listener)
Removes the specified IIOReadProgressListener.

param
listener the IIOReadProgressListener to be removed.

        throw new UnsupportedOperationException("Not implemented yet");
    
public voidremoveIIOReadUpdateListener(javax.imageio.event.IIOReadUpdateListener listener)
Removes the specified IIOReadUpdateListener.

param
listener the IIOReadUpdateListener to be removed.

        throw new UnsupportedOperationException("Not implemented yet");
    
public voidremoveIIOReadWarningListener(javax.imageio.event.IIOReadWarningListener listener)
Removes the specified IIOReadWarningListener.

param
listener the IIOReadWarningListener to be removed.

        throw new UnsupportedOperationException("Not implemented yet");
    
public voidreset()
Resets this ImageReader.

        // def
        setInput(null, false);
        setLocale(null);
        removeAllIIOReadUpdateListeners();
        removeAllIIOReadWarningListeners();
        removeAllIIOReadProgressListeners();
        clearAbortRequest();
    
public voidsetInput(java.lang.Object input, boolean seekForwardOnly, boolean ignoreMetadata)
Sets the specified Object as the input source of this ImageReader.

param
input the input source, it can be an ImageInputStream or other supported objects.
param
seekForwardOnly indicates whether the stream must be read sequentially from its current starting point.
param
ignoreMetadata parameter which indicates if metadata may be ignored during reads or not.

        if (input != null) {
            if (!isSupported(input) && !(input instanceof ImageInputStream)) {
                throw new IllegalArgumentException("input " + input + " is not supported");
            }
        }
        this.minIndex = 0;
        this.seekForwardOnly = seekForwardOnly;
        this.ignoreMetadata = ignoreMetadata;
        this.input = input;
    
public voidsetInput(java.lang.Object input, boolean seekForwardOnly)
Sets the specified Object as the input source of this ImageReader. Metadata is not ignored.

param
input the input source, it can be an ImageInputStream or other supported objects.
param
seekForwardOnly indicates whether the stream must be read sequentially from its current starting point.

        setInput(input, seekForwardOnly, false);
    
public voidsetInput(java.lang.Object input)
Sets the specified Object as the input source of this ImageReader. Metadata is not ignored and forward seeking is not required.

param
input the input source, it can be ImageInputStream or other objects.

        setInput(input, false, false);
    
public voidsetLocale(java.util.Locale locale)
Sets the locale to this ImageReader.

param
locale the Locale.

        throw new UnsupportedOperationException("Not implemented yet");