/*
* @(#)ImageReader.java 1.140 03/08/27
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package javax.imageio;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
import java.awt.image.RenderedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Set;
import javax.imageio.spi.ImageReaderSpi;
import javax.imageio.event.IIOReadWarningListener;
import javax.imageio.event.IIOReadProgressListener;
import javax.imageio.event.IIOReadUpdateListener;
import javax.imageio.metadata.IIOMetadata;
import javax.imageio.metadata.IIOMetadataFormatImpl;
import javax.imageio.stream.ImageInputStream;
/**
* An abstract superclass for parsing and decoding of images. This
* class must be subclassed by classes that read in images in the
* context of the Java Image I/O framework.
*
* <p> <code>ImageReader</code> objects are normally instantiated by
* the service provider interface (SPI) class for the specific format.
* Service provider classes (e.g., instances of
* <code>ImageReaderSpi</code>) are registered with the
* <code>IIORegistry</code>, which uses them for format recognition
* and presentation of available format readers and writers.
*
* <p> When an input source is set (using the <code>setInput</code>
* method), it may be marked as "seek forward only". This setting
* means that images contained within the input source will only be
* read in order, possibly allowing the reader to avoid caching
* portions of the input containing data associated with images that
* have been read previously.
*
* @see ImageWriter
* @see javax.imageio.spi.IIORegistry
* @see javax.imageio.spi.ImageReaderSpi
*
* @version 0.5
*/
public abstract class ImageReader {
/**
* The <code>ImageReaderSpi</code> that instantiated this object,
* or <code>null</code> if its identity is not known or none
* exists. By default it is initialized to <code>null</code>.
*/
protected ImageReaderSpi originatingProvider;
/**
* The <code>ImageInputStream</code> or other
* <code>Object</code> by <code>setInput</code> and retrieved
* by <code>getInput</code>. By default it is initialized to
* <code>null</code>.
*/
protected Object input = null;
/**
* <code>true</code> if the current input source has been marked
* as allowing only forward seeking by <code>setInput</code>. By
* default, the value is <code>false</code>.
*
* @see #minIndex
* @see #setInput
*/
protected boolean seekForwardOnly = false;
/**
* <code>true</code> if the current input source has been marked
* as allowing metadata to be ignored by <code>setInput</code>.
* By default, the value is <code>false</code>.
*
* @see #setInput
*/
protected boolean ignoreMetadata = false;
/**
* The smallest valid index for reading, initially 0. When
* <code>seekForwardOnly</code> is <code>true</code>, various methods
* may throw an <code>IndexOutOfBoundsException</code> on an
* attempt to access data associate with an image having a lower
* index.
*
* @see #seekForwardOnly
* @see #setInput
=1= |