* * @exception UnsupportedOperationException if this plug-in does not * support reading raw <code>Raster</code>s. * @exception IllegalArgumentException if the tile indices are * out of bounds. * @exception IllegalStateException if the input source has not been * set. * @exception IndexOutOfBoundsException if <code>imageIndex</code> * is out of bounds. * @exception IOException if an error occurs during reading. * * @see #readTile * @see #readRaster * @see java.awt.image.Raster */ public Raster readTileRaster(int imageIndex, int tileX, int tileY) throws IOException { if (!canReadRaster()) { throw new UnsupportedOperationException ("readTileRaster not supported!"); } if ((tileX != 0) || (tileY != 0)) { throw new IllegalArgumentException("Invalid tile indices"); } return readRaster(imageIndex, null); } // RenderedImages /** * Returns a <code>RenderedImage</code> object that contains the * contents of the image indexed by <code>imageIndex</code>. By * default, the returned image is simply the * <code>BufferedImage</code> returned by <code>read(imageIndex, * param)</code>. * * <p> The semantics of this method may differ from those of the * other <code>read</code> methods in several ways. First, any * destination image and/or image type set in the * <code>ImageReadParam</code> may be ignored. Second, the usual * listener calls are not guaranteed to be made, or to be * meaningful if they are. This is because the returned image may * not be fully populated with pixel data at the time it is * returned, or indeed at any time. * * <p> If the supplied <code>ImageReadParam</code> contains * optional setting values not supported by this reader (<i>e.g.</i> * source render size or any format-specific settings), they will * be ignored. * * <p> The default implementation just calls {@link #read * <code>read(imageIndex, param)</code>}. * * @param imageIndex the index of the image to be retrieved. * @param param an <code>ImageReadParam</code> used to control * the reading process, or <code>null</code>. * * @return a <code>RenderedImage</code> object providing a view of * the image. * * @exception IllegalStateException if the input source has not been * set. * @exception IndexOutOfBoundsException if the supplied index is * out of bounds. * @exception IllegalArgumentException if the set of source and * destination bands specified by * <code>param.getSourceBands</code> and * <code>param.getDestinationBands</code> differ in length or * include indices that are out of bounds. * @exception IllegalArgumentException if the resulting image * would have a width or height less than 1. * @exception IOException if an error occurs during reading. */ public RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param) throws IOException { return read(imageIndex, param); } // Thumbnails /** * Returns <code>true</code> if the image format understood by * this reader supports thumbnail preview images associated with * it. The default implementation returns <code>false</code>. * * <p> If this method returns <code>false</code>, * <code>hasThumbnails</code> and <code>getNumThumbnails</code> * will return <code>false</code> and <code>0</code>, * respectively, and <code>readThumbnail</code> will throw an * <code>UnsupportedOperationException</code>, regardless of their * arguments. * * <p> A reader that does not support thumbnails need not * implement any of the thumbnail-related methods. * * @return <code>true</code> if thumbnails are supported. */ public boolean readerSupportsThumbnails() { return false; } /** * Returns <code>true</code> if the given image has thumbnail * preview images associated with it. If the format does not * support thumbnails (<code>readerSupportsThumbnails</code> * returns <code>false</code>), <code>false</code> will be * returned regardless of whether an input source has been set or * whether <code>imageIndex</code> is in bounds. * * <p> The default implementation returns <code>true</code> if * <code>getNumThumbnails</code> returns a value greater than 0. * * @param imageIndex the index of the image being queried. * * @return <code>true</code> if the given image has thumbnails. * * @exception IllegalStateException if the reader supports * thumbnails but the input source has not been set. * @exception IndexOutOfBoundsException if the reader supports * thumbnails but <code>imageIndex</code> is out of bounds. * @exception IOException if an error occurs during reading. */ public boolean hasThumbnails(int imageIndex) throws IOException { return getNumThumbnails(imageIndex) > 0; } /** * Returns the number of thumbnail preview images associated with * the given image. If the format does not support thumbnails, * (<code>readerSupportsThumbnails</code> returns * <code>false</code>), <code>0</code> will be returned regardless * of whether an input source has been set or whether * <code>imageIndex</code> is in bounds. * * <p> The default implementation returns 0 without checking its * argument. * * @param imageIndex the index of the image being queried. * * @return the number of thumbnails associated with the given * image. * * @exception IllegalStateException if the reader supports * thumbnails but the input source has not been set. * @exception IndexOutOfBoundsException if the reader supports * thumbnails but <code>imageIndex</code> is out of bounds. * @exception IOException if an error occurs during reading. */ public int getNumThumbnails(int imageIndex) throws IOException { return 0; } /** * Returns the width of the thumbnail preview image indexed by * <code>thumbnailIndex</code>, associated with the image indexed * by <code>ImageIndex</code>. * * <p> If the reader does not support thumbnails, * (<code>readerSupportsThumbnails</code> returns * <code>false</code>), an <code>UnsupportedOperationException</code> * will be thrown. * * <p> The default implementation simply returns * <code>readThumbnail(imageindex, * thumbnailIndex).getWidth()</code>. Subclasses should therefore * override this method if possible in order to avoid forcing the * thumbnail to be read. * * @param imageIndex the index of the image to be retrieved. * @param thumbnailIndex the index of the thumbnail to be retrieved. * * @return the width of the desired thumbnail as an <code>int</code>. * * @exception UnsupportedOperationException if thumbnails are not * supported. * @exception IllegalStateException if the input source has not been set. * @exception IndexOutOfBoundsException if either of the supplied * indices are out of bounds. * @exception IOException if an error occurs during reading. */ public int getThumbnailWidth(int imageIndex, int thumbnailIndex) throws IOException { return readThumbnail(imageIndex, thumbnailIndex).getWidth(); } /** * Returns the height of the thumbnail preview image indexed by * <code>thumbnailIndex</code>, associated with the image indexed * by <code>ImageIndex</code>. * * <p> If the reader does not support thumbnails, * (<code>readerSupportsThumbnails</code> returns * <code>false</code>), an <code>UnsupportedOperationException</code> * will be thrown. * * <p> The default implementation simply returns * <code>readThumbnail(imageindex, * thumbnailIndex).getHeight()</code>. Subclasses should * therefore override this method if possible in order to avoid * forcing the thumbnail to be read. * * @param imageIndex the index of the image to be retrieved. * @param thumbnailIndex the index of the thumbnail to be retrieved. * * @return the height of the desired thumbnail as an <code>int</code>. * * @exception UnsupportedOperationException if thumbnails are not * supported. * @exception IllegalStateException if the input source has not been set. * @exception IndexOutOfBoundsException if either of the supplied * indices are out of bounds. * @exception IOException if an error occurs during reading. */ public int getThumbnailHeight(int imageIndex, int thumbnailIndex) throws IOException { return readThumbnail(imageIndex, thumbnailIndex).getHeight(); } /** * Returns the thumbnail preview image indexed by * <code>thumbnailIndex</code>, associated with the image indexed * by <code>ImageIndex</code> as a <code>BufferedImage</code>. * * <p> Any registered <code>IIOReadProgressListener</code> objects * will be notified by calling their * <code>thumbnailStarted</code>, <code>thumbnailProgress</code>, * and <code>thumbnailComplete</code> methods. * * <p> If the reader does not support thumbnails, * (<code>readerSupportsThumbnails</code> returns * <code>false</code>), an <code>UnsupportedOperationException</code> * will be thrown regardless of whether an input source has been * set or whether the indices are in bounds. * * <p> The default implementation throws an * <code>UnsupportedOperationException</code>. * * @param imageIndex the index of the image to be retrieved. * @param thumbnailIndex the index of the thumbnail to be retrieved. * * @return the desired thumbnail as a <code>BufferedImage</code>. * * @exception UnsupportedOperationException if thumbnails are not * supported. * @exception IllegalStateException if the input source has not been set. * @exception IndexOutOfBoundsException if either of the supplied * indices are out of bounds. * @exception IOException if an error occurs during reading. */ public BufferedImage readThumbnail(int imageIndex, int thumbnailIndex) throws IOException { throw new UnsupportedOperationException("Thumbnails not supported!"); } // Abort /** * Requests that any current read operation be aborted. The * contents of the image following the abort will be undefined. * * <p> Readers should call <code>clearAbortRequest</code> at the * beginning of each read operation, and poll the value of * <code>abortRequested</code> regularly during the read. */ public synchronized void abort() { this.abortFlag = true; } /** * Returns <code>true</code> if a request to abort the current * read operation has been made since the reader was instantiated or * <code>clearAbortRequest</code> was called. * * @return <code>true</code> if the current read operation should * be aborted. * * @see #abort * @see #clearAbortRequest */ protected synchronized boolean abortRequested() { return this.abortFlag; } /** * Clears any previous abort request. After this method has been * called, <code>abortRequested</code> will return * <code>false</code>. * * @see #abort * @see #abortRequested */ protected synchronized void clearAbortRequest() { this.abortFlag = false; } // Listeners // Add an element to a list, creating a new list if the // existing list is null, and return the list. static List addToList(List l, Object elt) { if (l == null) { l = new ArrayList(); } l.add(elt); return l; } // Remove an element from a list, discarding the list if the // resulting list is empty, and return the list or null. static List removeFromList(List l, Object elt) { if (l == null) { return l; } l.remove(elt); if (l.size() == 0) { l = null; } return l; } /** * Adds an <code>IIOReadWarningListener</code> to the list of * registered warning listeners. If <code>listener</code> is * <code>null</code>, no exception will be thrown and no action * will be taken. Messages sent to the given listener will be * localized, if possible, to match the current * <code>Locale</code>. If no <code>Locale</code> has been set, * warning messages may be localized as the reader sees fit. * * @param listener an <code>IIOReadWarningListener</code> to be registered. * * @see #removeIIOReadWarningListener */ public void addIIOReadWarningListener(IIOReadWarningListener listener) { if (listener == null) { return; } warningListeners = addToList(warningListeners, listener); warningLocales = addToList(warningLocales, getLocale()); } /** * Removes an <code>IIOReadWarningListener</code> from the list of * registered error listeners. If the listener was not previously * registered, or if <code>listener</code> is <code>null</code>, * no exception will be thrown and no action will be taken. * * @param listener an IIOReadWarningListener to be unregistered. * * @see #addIIOReadWarningListener */ public void removeIIOReadWarningListener(IIOReadWarningListener listener) { if (listener == null || warningListeners == null) { return; } int index = warningListeners.indexOf(listener); if (index != -1) { warningListeners.remove(index); warningLocales.remove(index); if (warningListeners.size() == 0) { warningListeners = null; warningLocales = null; } } } /** * Removes all currently registered * <code>IIOReadWarningListener</code> objects. * * <p> The default implementation sets the * <code>warningListeners</code> and <code>warningLocales</code> * instance variables to <code>null</code>. */ public void removeAllIIOReadWarningListeners() { warningListeners = null; warningLocales = null; } /** * Adds an <code>IIOReadProgressListener</code> to the list of * registered progress listeners. If <code>listener</code> is * <code>null</code>, no exception will be thrown and no action * will be taken. * * @param listener an IIOReadProgressListener to be registered. * * @see #removeIIOReadProgressListener */ public void addIIOReadProgressListener(IIOReadProgressListener listener) { if (listener == null) { return; } progressListeners = addToList(progressListeners, listener); } /** * Removes an <code>IIOReadProgressListener</code> from the list * of registered progress listeners. If the listener was not * previously registered, or if <code>listener</code> is * <code>null</code>, no exception will be thrown and no action * will be taken. * * @param listener an IIOReadProgressListener to be unregistered. * * @see #addIIOReadProgressListener */ public void removeIIOReadProgressListener (IIOReadProgressListener listener) { if (listener == null || progressListeners == null) { return; } progressListeners = removeFromList(progressListeners, listener); } /** * Removes all currently registered * <code>IIOReadProgressListener</code> objects. * * <p> The default implementation sets the * <code>progressListeners</code> instance variable to * <code>null</code>. */ public void removeAllIIOReadProgressListeners() { progressListeners = null; } /** * Adds an <code>IIOReadUpdateListener</code> to the list of * registered update listeners. If <code>listener</code> is * <code>null</code>, no exception will be thrown and no action * will be taken. The listener will receive notification of pixel * updates as images and thumbnails are decoded, including the * starts and ends of progressive passes. * * <p> If no update listeners are present, the reader may choose * to perform fewer updates to the pixels of the destination * images and/or thumbnails, which may result in more efficient * decoding. * * <p> For example, in progressive JPEG decoding each pass * contains updates to a set of coefficients, which would have to * be transformed into pixel values and converted to an RGB color * space for each pass if listeners are present. If no listeners * are present, the coefficients may simply be accumulated and the * final results transformed and color converted one time only. * * <p> The final results of decoding will be the same whether or * not intermediate updates are performed. Thus if only the final * image is desired it may be perferable not to register any * <code>IIOReadUpdateListener</code>s. In general, progressive * updating is most effective when fetching images over a network * connection that is very slow compared to local CPU processing; * over a fast connection, progressive updates may actually slow * down the presentation of the image. * * @param listener an IIOReadUpdateListener to be registered. * * @see #removeIIOReadUpdateListener */ public void addIIOReadUpdateListener(IIOReadUpdateListener listener) { if (listener == null) { return; } updateListeners = addToList(updateListeners, listener); } /** * Removes an <code>IIOReadUpdateListener</code> from the list of * registered update listeners. If the listener was not * previously registered, or if <code>listener</code> is * <code>null</code>, no exception will be thrown and no action * will be taken. * * @param listener an IIOReadUpdateListener to be unregistered. * * @see #addIIOReadUpdateListener */ public void removeIIOReadUpdateListener(IIOReadUpdateListener listener) { if (listener == null || updateListeners == null) { return; } updateListeners = removeFromList(updateListeners, listener); } /** * Removes all currently registered * <code>IIOReadUpdateListener</code> objects. * * <p> The default implementation sets the * <code>updateListeners</code> instance variable to * <code>null</code>. */ public void removeAllIIOReadUpdateListeners() { updateListeners = null;Lines 1501–2000 of 2898. Previous lines Load more
* * @exception UnsupportedOperationException if this plug-in does not * support reading raw <code>Raster</code>s. * @exception IllegalArgumentException if the tile indices are * out of bounds. * @exception IllegalStateException if the input source has not been * set. * @exception IndexOutOfBoundsException if <code>imageIndex</code> * is out of bounds. * @exception IOException if an error occurs during reading. * * @see #readTile * @see #readRaster * @see java.awt.image.Raster */ public Raster readTileRaster(int imageIndex, int tileX, int tileY) throws IOException { if (!canReadRaster()) { throw new UnsupportedOperationException ("readTileRaster not supported!"); } if ((tileX != 0) || (tileY != 0)) { throw new IllegalArgumentException("Invalid tile indices"); } return readRaster(imageIndex, null); } // RenderedImages /** * Returns a <code>RenderedImage</code> object that contains the * contents of the image indexed by <code>imageIndex</code>. By * default, the returned image is simply the * <code>BufferedImage</code> returned by <code>read(imageIndex, * param)</code>. * * <p> The semantics of this method may differ from those of the * other <code>read</code> methods in several ways. First, any * destination image and/or image type set in the * <code>ImageReadParam</code> may be ignored. Second, the usual * listener calls are not guaranteed to be made, or to be * meaningful if they are. This is because the returned image may * not be fully populated with pixel data at the time it is * returned, or indeed at any time. * * <p> If the supplied <code>ImageReadParam</code> contains * optional setting values not supported by this reader (<i>e.g.</i> * source render size or any format-specific settings), they will * be ignored. * * <p> The default implementation just calls {@link #read * <code>read(imageIndex, param)</code>}. * * @param imageIndex the index of the image to be retrieved. * @param param an <code>ImageReadParam</code> used to control * the reading process, or <code>null</code>. * * @return a <code>RenderedImage</code> object providing a view of * the image. * * @exception IllegalStateException if the input source has not been * set. * @exception IndexOutOfBoundsException if the supplied index is * out of bounds. * @exception IllegalArgumentException if the set of source and * destination bands specified by * <code>param.getSourceBands</code> and * <code>param.getDestinationBands</code> differ in length or * include indices that are out of bounds. * @exception IllegalArgumentException if the resulting image * would have a width or height less than 1. * @exception IOException if an error occurs during reading. */ public RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param) throws IOException { return read(imageIndex, param); } // Thumbnails /** * Returns <code>true</code> if the image format understood by * this reader supports thumbnail preview images associated with * it. The default implementation returns <code>false</code>. * * <p> If this method returns <code>false</code>, * <code>hasThumbnails</code> and <code>getNumThumbnails</code> * will return <code>false</code> and <code>0</code>, * respectively, and <code>readThumbnail</code> will throw an * <code>UnsupportedOperationException</code>, regardless of their * arguments. * * <p> A reader that does not support thumbnails need not * implement any of the thumbnail-related methods. * * @return <code>true</code> if thumbnails are supported. */ public boolean readerSupportsThumbnails() { return false; } /** * Returns <code>true</code> if the given image has thumbnail * preview images associated with it. If the format does not * support thumbnails (<code>readerSupportsThumbnails</code> * returns <code>false</code>), <code>false</code> will be * returned regardless of whether an input source has been set or * whether <code>imageIndex</code> is in bounds. * * <p> The default implementation returns <code>true</code> if * <code>getNumThumbnails</code> returns a value greater than 0. * * @param imageIndex the index of the image being queried. * * @return <code>true</code> if the given image has thumbnails. * * @exception IllegalStateException if the reader supports * thumbnails but the input source has not been set. * @exception IndexOutOfBoundsException if the reader supports * thumbnails but <code>imageIndex</code> is out of bounds. * @exception IOException if an error occurs during reading. */ public boolean hasThumbnails(int imageIndex) throws IOException { return getNumThumbnails(imageIndex) > 0; } /** * Returns the number of thumbnail preview images associated with * the given image. If the format does not support thumbnails, * (<code>readerSupportsThumbnails</code> returns * <code>false</code>), <code>0</code> will be returned regardless * of whether an input source has been set or whether * <code>imageIndex</code> is in bounds. * * <p> The default implementation returns 0 without checking its * argument. * * @param imageIndex the index of the image being queried. * * @return the number of thumbnails associated with the given * image. * * @exception IllegalStateException if the reader supports * thumbnails but the input source has not been set. * @exception IndexOutOfBoundsException if the reader supports * thumbnails but <code>imageIndex</code> is out of bounds. * @exception IOException if an error occurs during reading. */ public int getNumThumbnails(int imageIndex) throws IOException { return 0; } /** * Returns the width of the thumbnail preview image indexed by * <code>thumbnailIndex</code>, associated with the image indexed * by <code>ImageIndex</code>. * * <p> If the reader does not support thumbnails, * (<code>readerSupportsThumbnails</code> returns * <code>false</code>), an <code>UnsupportedOperationException</code> * will be thrown. * * <p> The default implementation simply returns * <code>readThumbnail(imageindex, * thumbnailIndex).getWidth()</code>. Subclasses should therefore * override this method if possible in order to avoid forcing the * thumbnail to be read. * * @param imageIndex the index of the image to be retrieved. * @param thumbnailIndex the index of the thumbnail to be retrieved. * * @return the width of the desired thumbnail as an <code>int</code>. * * @exception UnsupportedOperationException if thumbnails are not * supported. * @exception IllegalStateException if the input source has not been set. * @exception IndexOutOfBoundsException if either of the supplied * indices are out of bounds. * @exception IOException if an error occurs during reading. */ public int getThumbnailWidth(int imageIndex, int thumbnailIndex) throws IOException { return readThumbnail(imageIndex, thumbnailIndex).getWidth(); } /** * Returns the height of the thumbnail preview image indexed by * <code>thumbnailIndex</code>, associated with the image indexed * by <code>ImageIndex</code>. * * <p> If the reader does not support thumbnails, * (<code>readerSupportsThumbnails</code> returns * <code>false</code>), an <code>UnsupportedOperationException</code> * will be thrown. * * <p> The default implementation simply returns * <code>readThumbnail(imageindex, * thumbnailIndex).getHeight()</code>. Subclasses should * therefore override this method if possible in order to avoid * forcing the thumbnail to be read. * * @param imageIndex the index of the image to be retrieved. * @param thumbnailIndex the index of the thumbnail to be retrieved. * * @return the height of the desired thumbnail as an <code>int</code>. * * @exception UnsupportedOperationException if thumbnails are not * supported. * @exception IllegalStateException if the input source has not been set. * @exception IndexOutOfBoundsException if either of the supplied * indices are out of bounds. * @exception IOException if an error occurs during reading. */ public int getThumbnailHeight(int imageIndex, int thumbnailIndex) throws IOException { return readThumbnail(imageIndex, thumbnailIndex).getHeight(); } /** * Returns the thumbnail preview image indexed by * <code>thumbnailIndex</code>, associated with the image indexed * by <code>ImageIndex</code> as a <code>BufferedImage</code>. * * <p> Any registered <code>IIOReadProgressListener</code> objects * will be notified by calling their * <code>thumbnailStarted</code>, <code>thumbnailProgress</code>, * and <code>thumbnailComplete</code> methods. * * <p> If the reader does not support thumbnails, * (<code>readerSupportsThumbnails</code> returns * <code>false</code>), an <code>UnsupportedOperationException</code> * will be thrown regardless of whether an input source has been * set or whether the indices are in bounds. * * <p> The default implementation throws an * <code>UnsupportedOperationException</code>. * * @param imageIndex the index of the image to be retrieved. * @param thumbnailIndex the index of the thumbnail to be retrieved. * * @return the desired thumbnail as a <code>BufferedImage</code>. * * @exception UnsupportedOperationException if thumbnails are not * supported. * @exception IllegalStateException if the input source has not been set. * @exception IndexOutOfBoundsException if either of the supplied * indices are out of bounds. * @exception IOException if an error occurs during reading. */ public BufferedImage readThumbnail(int imageIndex, int thumbnailIndex) throws IOException { throw new UnsupportedOperationException("Thumbnails not supported!"); } // Abort /** * Requests that any current read operation be aborted. The * contents of the image following the abort will be undefined. * * <p> Readers should call <code>clearAbortRequest</code> at the * beginning of each read operation, and poll the value of * <code>abortRequested</code> regularly during the read. */ public synchronized void abort() { this.abortFlag = true; } /** * Returns <code>true</code> if a request to abort the current * read operation has been made since the reader was instantiated or * <code>clearAbortRequest</code> was called. * * @return <code>true</code> if the current read operation should * be aborted. * * @see #abort * @see #clearAbortRequest */ protected synchronized boolean abortRequested() { return this.abortFlag; } /** * Clears any previous abort request. After this method has been * called, <code>abortRequested</code> will return * <code>false</code>. * * @see #abort * @see #abortRequested */ protected synchronized void clearAbortRequest() { this.abortFlag = false; } // Listeners // Add an element to a list, creating a new list if the // existing list is null, and return the list. static List addToList(List l, Object elt) { if (l == null) { l = new ArrayList(); } l.add(elt); return l; } // Remove an element from a list, discarding the list if the // resulting list is empty, and return the list or null. static List removeFromList(List l, Object elt) { if (l == null) { return l; } l.remove(elt); if (l.size() == 0) { l = null; } return l; } /** * Adds an <code>IIOReadWarningListener</code> to the list of * registered warning listeners. If <code>listener</code> is * <code>null</code>, no exception will be thrown and no action * will be taken. Messages sent to the given listener will be * localized, if possible, to match the current * <code>Locale</code>. If no <code>Locale</code> has been set, * warning messages may be localized as the reader sees fit. * * @param listener an <code>IIOReadWarningListener</code> to be registered. * * @see #removeIIOReadWarningListener */ public void addIIOReadWarningListener(IIOReadWarningListener listener) { if (listener == null) { return; } warningListeners = addToList(warningListeners, listener); warningLocales = addToList(warningLocales, getLocale()); } /** * Removes an <code>IIOReadWarningListener</code> from the list of * registered error listeners. If the listener was not previously * registered, or if <code>listener</code> is <code>null</code>, * no exception will be thrown and no action will be taken. * * @param listener an IIOReadWarningListener to be unregistered. * * @see #addIIOReadWarningListener */ public void removeIIOReadWarningListener(IIOReadWarningListener listener) { if (listener == null || warningListeners == null) { return; } int index = warningListeners.indexOf(listener); if (index != -1) { warningListeners.remove(index); warningLocales.remove(index); if (warningListeners.size() == 0) { warningListeners = null; warningLocales = null; } } } /** * Removes all currently registered * <code>IIOReadWarningListener</code> objects. * * <p> The default implementation sets the * <code>warningListeners</code> and <code>warningLocales</code> * instance variables to <code>null</code>. */ public void removeAllIIOReadWarningListeners() { warningListeners = null; warningLocales = null; } /** * Adds an <code>IIOReadProgressListener</code> to the list of * registered progress listeners. If <code>listener</code> is * <code>null</code>, no exception will be thrown and no action * will be taken. * * @param listener an IIOReadProgressListener to be registered. * * @see #removeIIOReadProgressListener */ public void addIIOReadProgressListener(IIOReadProgressListener listener) { if (listener == null) { return; } progressListeners = addToList(progressListeners, listener); } /** * Removes an <code>IIOReadProgressListener</code> from the list * of registered progress listeners. If the listener was not * previously registered, or if <code>listener</code> is * <code>null</code>, no exception will be thrown and no action * will be taken. * * @param listener an IIOReadProgressListener to be unregistered. * * @see #addIIOReadProgressListener */ public void removeIIOReadProgressListener (IIOReadProgressListener listener) { if (listener == null || progressListeners == null) { return; } progressListeners = removeFromList(progressListeners, listener); } /** * Removes all currently registered * <code>IIOReadProgressListener</code> objects. * * <p> The default implementation sets the * <code>progressListeners</code> instance variable to * <code>null</code>. */ public void removeAllIIOReadProgressListeners() { progressListeners = null; } /** * Adds an <code>IIOReadUpdateListener</code> to the list of * registered update listeners. If <code>listener</code> is * <code>null</code>, no exception will be thrown and no action * will be taken. The listener will receive notification of pixel * updates as images and thumbnails are decoded, including the * starts and ends of progressive passes. * * <p> If no update listeners are present, the reader may choose * to perform fewer updates to the pixels of the destination * images and/or thumbnails, which may result in more efficient * decoding. * * <p> For example, in progressive JPEG decoding each pass * contains updates to a set of coefficients, which would have to * be transformed into pixel values and converted to an RGB color * space for each pass if listeners are present. If no listeners * are present, the coefficients may simply be accumulated and the * final results transformed and color converted one time only. * * <p> The final results of decoding will be the same whether or * not intermediate updates are performed. Thus if only the final * image is desired it may be perferable not to register any * <code>IIOReadUpdateListener</code>s. In general, progressive * updating is most effective when fetching images over a network * connection that is very slow compared to local CPU processing; * over a fast connection, progressive updates may actually slow * down the presentation of the image. * * @param listener an IIOReadUpdateListener to be registered. * * @see #removeIIOReadUpdateListener */ public void addIIOReadUpdateListener(IIOReadUpdateListener listener) { if (listener == null) { return; } updateListeners = addToList(updateListeners, listener); } /** * Removes an <code>IIOReadUpdateListener</code> from the list of * registered update listeners. If the listener was not * previously registered, or if <code>listener</code> is * <code>null</code>, no exception will be thrown and no action * will be taken. * * @param listener an IIOReadUpdateListener to be unregistered. * * @see #addIIOReadUpdateListener */ public void removeIIOReadUpdateListener(IIOReadUpdateListener listener) { if (listener == null || updateListeners == null) { return; } updateListeners = removeFromList(updateListeners, listener); } /** * Removes all currently registered * <code>IIOReadUpdateListener</code> objects. * * <p> The default implementation sets the * <code>updateListeners</code> instance variable to * <code>null</code>. */ public void removeAllIIOReadUpdateListeners() { updateListeners = null;