2362N/A * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * A class containing static convenience methods for locating 0N/A * <code>ImageReader</code>s and <code>ImageWriter</code>s, and 0N/A * performing simple encoding and decoding. 0N/A * Constructor is private to prevent instantiation. 0N/A * Scans for plug-ins on the application class path, 0N/A * loads their service provider classes, and registers a service 0N/A * provider instance for each one found with the 0N/A * <code>IIORegistry</code>. 0N/A * <p>This method is needed because the application class path can 0N/A * theoretically change, or additional plug-ins may become available. 0N/A * Rather than re-scanning the classpath on every invocation of the 0N/A * API, the class path is scanned automatically only on the first 0N/A * invocation. Clients can call this method to prompt a re-scan. 0N/A * Thus this method need only be invoked by sophisticated applications 0N/A * which dynamically make new plug-ins available at runtime. 0N/A * <p> The <code>getResources</code> method of the context 0N/A * <code>ClassLoader</code> is used locate JAR files containing 0N/A * where <i>classname</i> is one of <code>ImageReaderSpi</code>, 0N/A * <code>ImageWriterSpi</code>, <code>ImageTranscoderSpi</code>, 0N/A * <code>ImageInputStreamSpi</code>, or 0N/A * <code>ImageOutputStreamSpi</code>, along the application class 0N/A * <p> The contents of the located files indicate the names of 0N/A * actual implementation classes which implement the 0N/A * aforementioned service provider interfaces; the default class 0N/A * loader is then used to load each of these classes and to 0N/A * instantiate an instance of each class, which is then placed 0N/A * into the registry for later retrieval. 0N/A * <p> The exact set of locations searched depends on the 0N/A * implementation of the Java runtime enviroment. 0N/A * @see ClassLoader#getResources 0N/A // ImageInputStreams 0N/A * A class to hold information about caching. Each 0N/A * <code>ThreadGroup</code> will have its own copy 0N/A * via the <code>AppContext</code> mechanism. 0N/A * Returns the <code>CacheInfo</code> object associated with this 0N/A * <code>ThreadGroup</code>. 0N/A * Returns the default temporary (cache) directory as defined by the 0N/A * java.io.tmpdir system property. 0N/A * Determines whether the caller has write access to the cache 0N/A * directory, stores the result in the <code>CacheInfo</code> object, 0N/A * and returns the decision. This method helps to prevent mysterious 0N/A * SecurityExceptions to be thrown when this convenience class is used 0N/A * in an applet, for example. 1292N/A // we have to check whether we can read, write, 1292N/A // So, compose cache file path and check it. 0N/A * Sets a flag indicating whether a disk-based cache file should 0N/A * be used when creating <code>ImageInputStream</code>s and 0N/A * <code>ImageOutputStream</code>s. 0N/A * <p> When reading from a standard <code>InputStream</code>>, it 0N/A * may be necessary to save previously read information in a cache 0N/A * since the underlying stream does not allow data to be re-read. 0N/A * Similarly, when writing to a standard 0N/A * <code>OutputStream</code>, a cache may be used to allow a 0N/A * previously written value to be changed before flushing it to 0N/A * the final destination. 0N/A * <p> The cache may reside in main memory or on disk. Setting 0N/A * this flag to <code>false</code> disallows the use of disk for 0N/A * future streams, which may be advantageous when working with 0N/A * small images, as the overhead of creating and destroying files 0N/A * <p> On startup, the value is set to <code>true</code>. 0N/A * @param useCache a <code>boolean</code> indicating whether a 0N/A * cache file should be used, in cases where it is optional. 0N/A * Returns the current value set by <code>setUseCache</code>, or 0N/A * <code>true</code> if no explicit setting has been made. 0N/A * @return true if a disk-based cache may be used for 0N/A * <code>ImageInputStream</code>s and 0N/A * <code>ImageOutputStream</code>s. 0N/A * Sets the directory where cache files are to be created. A 0N/A * value of <code>null</code> indicates that the system-dependent 0N/A * default temporary-file directory is to be used. If 0N/A * <code>getUseCache</code> returns false, this value is ignored. 0N/A * @param cacheDirectory a <code>File</code> specifying a directory. 0N/A * @see File#createTempFile(String, String, File) 0N/A * @exception SecurityException if the security manager denies 0N/A * access to the directory. 0N/A * @exception IllegalArgumentException if <code>cacheDir</code> is 0N/A * non-<code>null</code> but is not a directory. 0N/A * @see #getCacheDirectory 0N/A * Returns the current value set by 0N/A * <code>setCacheDirectory</code>, or <code>null</code> if no 0N/A * explicit setting has been made. 0N/A * @return a <code>File</code> indicating the directory where 0N/A * cache files will be created, or <code>null</code> to indicate 0N/A * the system-dependent default temporary-file directory. 0N/A * @see #setCacheDirectory 0N/A * Returns an <code>ImageInputStream</code> that will take its 0N/A * input from the given <code>Object</code>. The set of 0N/A * <code>ImageInputStreamSpi</code>s registered with the 0N/A * <code>IIORegistry</code> class is queried and the first one 0N/A * that is able to take input from the supplied object is used to 0N/A * create the returned <code>ImageInputStream</code>. If no 0N/A * suitable <code>ImageInputStreamSpi</code> exists, 0N/A * <code>null</code> is returned. 0N/A * <p> The current cache settings from <code>getUseCache</code>and 0N/A * <code>getCacheDirectory</code> will be used to control caching. 0N/A * @param input an <code>Object</code> to be used as an input 0N/A * source, such as a <code>File</code>, readable 0N/A * <code>RandomAccessFile</code>, or <code>InputStream</code>. 0N/A * @return an <code>ImageInputStream</code>, or <code>null</code>. 0N/A * @exception IllegalArgumentException if <code>input</code> 0N/A * is <code>null</code>. 0N/A * @exception IOException if a cache file is needed but cannot be 0N/A * @see javax.imageio.spi.ImageInputStreamSpi 0N/A // Ensure category is present 0N/A // ImageOutputStreams 0N/A * Returns an <code>ImageOutputStream</code> that will send its 0N/A * output to the given <code>Object</code>. The set of 0N/A * <code>ImageOutputStreamSpi</code>s registered with the 0N/A * <code>IIORegistry</code> class is queried and the first one 0N/A * that is able to send output from the supplied object is used to 0N/A * create the returned <code>ImageOutputStream</code>. If no 0N/A * suitable <code>ImageOutputStreamSpi</code> exists, 0N/A * <code>null</code> is returned. 0N/A * <p> The current cache settings from <code>getUseCache</code>and 0N/A * <code>getCacheDirectory</code> will be used to control caching. 0N/A * @param output an <code>Object</code> to be used as an output 0N/A * destination, such as a <code>File</code>, writable 0N/A * <code>RandomAccessFile</code>, or <code>OutputStream</code>. 0N/A * @return an <code>ImageOutputStream</code>, or 0N/A * <code>null</code>. 0N/A * @exception IllegalArgumentException if <code>output</code> is 0N/A * <code>null</code>. 0N/A * @exception IOException if a cache file is needed but cannot be 0N/A * @see javax.imageio.spi.ImageOutputStreamSpi 0N/A // Ensure category is present 0N/A // Ensure category is present 0N/A * Returns an array of <code>String</code>s listing all of the 0N/A * informal format names understood by the current set of registered 0N/A * @return an array of <code>String</code>s. 0N/A * Returns an array of <code>String</code>s listing all of the 0N/A * MIME types understood by the current set of registered 0N/A * @return an array of <code>String</code>s. 0N/A * Returns an array of <code>String</code>s listing all of the 0N/A * file suffixes associated with the formats understood 0N/A * by the current set of registered readers. 0N/A * @return an array of <code>String</code>s. 0N/A // Contains ImageReaderSpis 0N/A // Deregister the spi in this case, but only as 0N/A // an ImageReaderSpi 0N/A // even though plug-ins are supposed to take 0N/A // method returns an array of Strings 0N/A * Returns an <code>Iterator</code> containing all currently 0N/A * registered <code>ImageReader</code>s that claim to be able to 0N/A * decode the supplied <code>Object</code>, typically an 0N/A * <code>ImageInputStream</code>. 0N/A * <p> The stream position is left at its prior position upon 0N/A * exit from this method. 0N/A * @param input an <code>ImageInputStream</code> or other 0N/A * <code>Object</code> containing encoded image data. 0N/A * @return an <code>Iterator</code> containing <code>ImageReader</code>s. 0N/A * @exception IllegalArgumentException if <code>input</code> is 0N/A * <code>null</code>. 0N/A * @see javax.imageio.spi.ImageReaderSpi#canDecodeInput 0N/A // Ensure category is present 0N/A * Returns an <code>Iterator</code> containing all currently 0N/A * registered <code>ImageReader</code>s that claim to be able to 0N/A * decode the named format. 0N/A * @param formatName a <code>String</code> containing the informal 0N/A * name of a format (<i>e.g.</i>, "jpeg" or "tiff". 0N/A * @return an <code>Iterator</code> containing 0N/A * <code>ImageReader</code>s. 0N/A * @exception IllegalArgumentException if <code>formatName</code> 0N/A * is <code>null</code>. 0N/A * @see javax.imageio.spi.ImageReaderSpi#getFormatNames 0N/A // Ensure category is present 0N/A * Returns an <code>Iterator</code> containing all currently 0N/A * registered <code>ImageReader</code>s that claim to be able to 0N/A * decode files with the given suffix. 0N/A * @param fileSuffix a <code>String</code> containing a file 0N/A * suffix (<i>e.g.</i>, "jpg" or "tiff"). 0N/A * @return an <code>Iterator</code> containing 0N/A * <code>ImageReader</code>s. 0N/A * @exception IllegalArgumentException if <code>fileSuffix</code> 0N/A * is <code>null</code>. 0N/A * @see javax.imageio.spi.ImageReaderSpi#getFileSuffixes 0N/A // Ensure category is present 0N/A * Returns an <code>Iterator</code> containing all currently 0N/A * registered <code>ImageReader</code>s that claim to be able to 0N/A * decode files with the given MIME type. 0N/A * @param MIMEType a <code>String</code> containing a file 0N/A * @return an <code>Iterator</code> containing 0N/A * <code>ImageReader</code>s. 0N/A * @exception IllegalArgumentException if <code>MIMEType</code> is 0N/A * <code>null</code>. 0N/A * @see javax.imageio.spi.ImageReaderSpi#getMIMETypes 0N/A // Ensure category is present 0N/A * Returns an array of <code>String</code>s listing all of the 0N/A * informal format names understood by the current set of registered 0N/A * @return an array of <code>String</code>s. 0N/A * Returns an array of <code>String</code>s listing all of the 0N/A * MIME types understood by the current set of registered 0N/A * @return an array of <code>String</code>s. 0N/A * Returns an array of <code>String</code>s listing all of the 0N/A * file suffixes associated with the formats understood 0N/A * by the current set of registered writers. 0N/A * @return an array of <code>String</code>s. 0N/A // Contains ImageWriterSpis 0N/A // Deregister the spi in this case, but only as a writerSpi 0N/A * Returns an <code>Iterator</code> containing all currently 0N/A * registered <code>ImageWriter</code>s that claim to be able to 0N/A * encode the named format. 0N/A * @param formatName a <code>String</code> containing the informal 0N/A * name of a format (<i>e.g.</i>, "jpeg" or "tiff". 0N/A * @return an <code>Iterator</code> containing 0N/A * <code>ImageWriter</code>s. 0N/A * @exception IllegalArgumentException if <code>formatName</code> is 0N/A * <code>null</code>. 0N/A * @see javax.imageio.spi.ImageWriterSpi#getFormatNames 0N/A // Ensure category is present 0N/A * Returns an <code>Iterator</code> containing all currently 0N/A * registered <code>ImageWriter</code>s that claim to be able to 0N/A * encode files with the given suffix. 0N/A * @param fileSuffix a <code>String</code> containing a file 0N/A * suffix (<i>e.g.</i>, "jpg" or "tiff"). 0N/A * @return an <code>Iterator</code> containing <code>ImageWriter</code>s. 0N/A * @exception IllegalArgumentException if <code>fileSuffix</code> is 0N/A * <code>null</code>. 0N/A * @see javax.imageio.spi.ImageWriterSpi#getFileSuffixes 0N/A // Ensure category is present 0N/A * Returns an <code>Iterator</code> containing all currently 0N/A * registered <code>ImageWriter</code>s that claim to be able to 0N/A * encode files with the given MIME type. 0N/A * @param MIMEType a <code>String</code> containing a file 0N/A * @return an <code>Iterator</code> containing <code>ImageWriter</code>s. 0N/A * @exception IllegalArgumentException if <code>MIMEType</code> is 0N/A * <code>null</code>. 0N/A * @see javax.imageio.spi.ImageWriterSpi#getMIMETypes 0N/A // Ensure category is present 0N/A * Returns an <code>ImageWriter</code>corresponding to the given 0N/A * <code>ImageReader</code>, if there is one, or <code>null</code> 0N/A * if the plug-in for this <code>ImageReader</code> does not 0N/A * specify a corresponding <code>ImageWriter</code>, or if the 0N/A * given <code>ImageReader</code> is not registered. This 0N/A * mechanism may be used to obtain an <code>ImageWriter</code> 0N/A * that will understand the internal structure of non-pixel 0N/A * metadata (as encoded by <code>IIOMetadata</code> objects) 0N/A * generated by the <code>ImageReader</code>. By obtaining this 0N/A * data from the <code>ImageReader</code> and passing it on to the 0N/A * <code>ImageWriter</code> obtained with this method, a client 0N/A * program can read an image, modify it in some way, and write it 0N/A * back out preserving all metadata, without having to understand 0N/A * anything about the structure of the metadata, or even about 0N/A * the image format. Note that this method returns the 0N/A * "preferred" writer, which is the first in the list returned by 0N/A * <code>javax.imageio.spi.ImageReaderSpi.getImageWriterSpiNames()</code>. 0N/A * @param reader an instance of a registered <code>ImageReader</code>. 0N/A * @return an <code>ImageWriter</code>, or null. 0N/A * @exception IllegalArgumentException if <code>reader</code> is 0N/A * <code>null</code>. 0N/A * @see #getImageReader(ImageWriter) 0N/A * @see javax.imageio.spi.ImageReaderSpi#getImageWriterSpiNames() 0N/A // Ensure category is present 0N/A // Deregister the spi in this case, but only as a writerSpi 0N/A * Returns an <code>ImageReader</code>corresponding to the given 0N/A * <code>ImageWriter</code>, if there is one, or <code>null</code> 0N/A * if the plug-in for this <code>ImageWriter</code> does not 0N/A * specify a corresponding <code>ImageReader</code>, or if the 0N/A * given <code>ImageWriter</code> is not registered. This method 0N/A * is provided principally for symmetry with 0N/A * <code>getImageWriter(ImageReader)</code>. Note that this 0N/A * method returns the "preferred" reader, which is the first in 0N/A * the list returned by 0N/A * javax.imageio.spi.ImageWriterSpi.<code>getImageReaderSpiNames()</code>. 0N/A * @param writer an instance of a registered <code>ImageWriter</code>. 0N/A * @return an <code>ImageReader</code>, or null. 0N/A * @exception IllegalArgumentException if <code>writer</code> is 0N/A * <code>null</code>. 0N/A * @see #getImageWriter(ImageReader) 0N/A * @see javax.imageio.spi.ImageWriterSpi#getImageReaderSpiNames() 0N/A // Ensure category is present 0N/A // Deregister the spi in this case, but only as a readerSpi 0N/A * Returns an <code>Iterator</code> containing all currently 0N/A * registered <code>ImageWriter</code>s that claim to be able to 0N/A * encode images of the given layout (specified using an 0N/A * <code>ImageTypeSpecifier</code>) in the given format. 0N/A * @param type an <code>ImageTypeSpecifier</code> indicating the 0N/A * layout of the image to be written. 0N/A * @param formatName the informal name of the <code>format</code>. 0N/A * @return an <code>Iterator</code> containing <code>ImageWriter</code>s. 0N/A * @exception IllegalArgumentException if any parameter is 0N/A * <code>null</code>. 0N/A * @see javax.imageio.spi.ImageWriterSpi#canEncodeImage(ImageTypeSpecifier) 0N/A // Ensure category is present 0N/A // Contains ImageTranscoderSpis 0N/A * Returns an <code>Iterator</code> containing all currently 0N/A * registered <code>ImageTranscoder</code>s that claim to be 0N/A * able to transcode between the metadata of the given 0N/A * <code>ImageReader</code> and <code>ImageWriter</code>. 0N/A * @param reader an <code>ImageReader</code>. 0N/A * @param writer an <code>ImageWriter</code>. 0N/A * @return an <code>Iterator</code> containing 0N/A * <code>ImageTranscoder</code>s. 0N/A * @exception IllegalArgumentException if <code>reader</code> or 0N/A * <code>writer</code> is <code>null</code>. 0N/A // Ensure category is present 0N/A // All-in-one methods 0N/A * Returns a <code>BufferedImage</code> as the result of decoding 0N/A * a supplied <code>File</code> with an <code>ImageReader</code> 0N/A * chosen automatically from among those currently registered. 0N/A * The <code>File</code> is wrapped in an 0N/A * <code>ImageInputStream</code>. If no registered 0N/A * <code>ImageReader</code> claims to be able to read the 0N/A * resulting stream, <code>null</code> is returned. 0N/A * <p> The current cache settings from <code>getUseCache</code>and 0N/A * <code>getCacheDirectory</code> will be used to control caching in the 0N/A * <code>ImageInputStream</code> that is created. 0N/A * <p> Note that there is no <code>read</code> method that takes a 0N/A * filename as a <code>String</code>; use this method instead after 0N/A * creating a <code>File</code> from the filename. 0N/A * <p> This method does not attempt to locate 0N/A * <code>ImageReader</code>s that can read directly from a 0N/A * <code>File</code>; that may be accomplished using 0N/A * <code>IIORegistry</code> and <code>ImageReaderSpi</code>. 0N/A * @param input a <code>File</code> to read from. 0N/A * @return a <code>BufferedImage</code> containing the decoded 0N/A * contents of the input, or <code>null</code>. 0N/A * @exception IllegalArgumentException if <code>input</code> is 0N/A * <code>null</code>. 0N/A * @exception IOException if an error occurs during reading. 0N/A * Returns a <code>BufferedImage</code> as the result of decoding 0N/A * a supplied <code>InputStream</code> with an <code>ImageReader</code> 0N/A * chosen automatically from among those currently registered. 0N/A * The <code>InputStream</code> is wrapped in an 0N/A * <code>ImageInputStream</code>. If no registered 0N/A * <code>ImageReader</code> claims to be able to read the 0N/A * resulting stream, <code>null</code> is returned. 0N/A * <p> The current cache settings from <code>getUseCache</code>and 0N/A * <code>getCacheDirectory</code> will be used to control caching in the 0N/A * <code>ImageInputStream</code> that is created. 0N/A * <p> This method does not attempt to locate 0N/A * <code>ImageReader</code>s that can read directly from an 0N/A * <code>InputStream</code>; that may be accomplished using 0N/A * <code>IIORegistry</code> and <code>ImageReaderSpi</code>. 0N/A * <p> This method <em>does not</em> close the provided 0N/A * <code>InputStream</code> after the read operation has completed; 0N/A * it is the responsibility of the caller to close the stream, if desired. 0N/A * @param input an <code>InputStream</code> to read from. 0N/A * @return a <code>BufferedImage</code> containing the decoded 0N/A * contents of the input, or <code>null</code>. 0N/A * @exception IllegalArgumentException if <code>input</code> is 0N/A * <code>null</code>. 0N/A * @exception IOException if an error occurs during reading. 0N/A * Returns a <code>BufferedImage</code> as the result of decoding 0N/A * a supplied <code>URL</code> with an <code>ImageReader</code> 0N/A * chosen automatically from among those currently registered. An 0N/A * <code>InputStream</code> is obtained from the <code>URL</code>, 0N/A * which is wrapped in an <code>ImageInputStream</code>. If no 0N/A * registered <code>ImageReader</code> claims to be able to read 0N/A * the resulting stream, <code>null</code> is returned. 0N/A * <p> The current cache settings from <code>getUseCache</code>and 0N/A * <code>getCacheDirectory</code> will be used to control caching in the 0N/A * <code>ImageInputStream</code> that is created. 0N/A * <p> This method does not attempt to locate 0N/A * <code>ImageReader</code>s that can read directly from a 0N/A * <code>URL</code>; that may be accomplished using 0N/A * <code>IIORegistry</code> and <code>ImageReaderSpi</code>. 0N/A * @param input a <code>URL</code> to read from. 0N/A * @return a <code>BufferedImage</code> containing the decoded 0N/A * contents of the input, or <code>null</code>. 0N/A * @exception IllegalArgumentException if <code>input</code> is 0N/A * <code>null</code>. 0N/A * @exception IOException if an error occurs during reading. 0N/A * Returns a <code>BufferedImage</code> as the result of decoding 0N/A * a supplied <code>ImageInputStream</code> with an 0N/A * <code>ImageReader</code> chosen automatically from among those 0N/A * currently registered. If no registered 0N/A * <code>ImageReader</code> claims to be able to read the stream, 0N/A * <code>null</code> is returned. 0N/A * <p> Unlike most other methods in this class, this method <em>does</em> 0N/A * close the provided <code>ImageInputStream</code> after the read 0N/A * operation has completed, unless <code>null</code> is returned, 0N/A * in which case this method <em>does not</em> close the stream. 0N/A * @param stream an <code>ImageInputStream</code> to read from. 0N/A * @return a <code>BufferedImage</code> containing the decoded 0N/A * contents of the input, or <code>null</code>. 0N/A * @exception IllegalArgumentException if <code>stream</code> is 0N/A * <code>null</code>. 0N/A * @exception IOException if an error occurs during reading. 0N/A * Writes an image using the an arbitrary <code>ImageWriter</code> 0N/A * that supports the given format to an 0N/A * <code>ImageOutputStream</code>. The image is written to the 0N/A * <code>ImageOutputStream</code> starting at the current stream 0N/A * pointer, overwriting existing stream data from that point 0N/A * forward, if present. 0N/A * <p> This method <em>does not</em> close the provided 0N/A * <code>ImageOutputStream</code> after the write operation has completed; 0N/A * it is the responsibility of the caller to close the stream, if desired. 0N/A * @param im a <code>RenderedImage</code> to be written. 0N/A * @param formatName a <code>String</code> containg the informal 0N/A * name of the format. 0N/A * @param output an <code>ImageOutputStream</code> to be written to. 0N/A * @return <code>false</code> if no appropriate writer is found. 0N/A * @exception IllegalArgumentException if any parameter is 0N/A * <code>null</code>. 0N/A * @exception IOException if an error occurs during writing. 0N/A * Writes an image using an arbitrary <code>ImageWriter</code> 0N/A * that supports the given format to a <code>File</code>. If 0N/A * there is already a <code>File</code> present, its contents are 0N/A * @param im a <code>RenderedImage</code> to be written. 0N/A * @param formatName a <code>String</code> containg the informal 0N/A * name of the format. 0N/A * @param output a <code>File</code> to be written to. 0N/A * @return <code>false</code> if no appropriate writer is found. 0N/A * @exception IllegalArgumentException if any parameter is 0N/A * <code>null</code>. 0N/A * @exception IOException if an error occurs during writing. 0N/A /* Do not make changes in the file system if we have 0N/A * no appropriate writer. 0N/A * Writes an image using an arbitrary <code>ImageWriter</code> 0N/A * that supports the given format to an <code>OutputStream</code>. 0N/A * <p> This method <em>does not</em> close the provided 0N/A * <code>OutputStream</code> after the write operation has completed; 0N/A * it is the responsibility of the caller to close the stream, if desired. 0N/A * <p> The current cache settings from <code>getUseCache</code>and 0N/A * <code>getCacheDirectory</code> will be used to control caching. 0N/A * @param im a <code>RenderedImage</code> to be written. 0N/A * @param formatName a <code>String</code> containg the informal 0N/A * name of the format. 0N/A * @param output an <code>OutputStream</code> to be written to. 0N/A * @return <code>false</code> if no appropriate writer is found. 0N/A * @exception IllegalArgumentException if any parameter is 0N/A * <code>null</code>. 0N/A * @exception IOException if an error occurs during writing. 0N/A * Returns <code>ImageWriter</code> instance according to given 0N/A * rendered image and image format or <code>null</code> if there 0N/A * is no appropriate writer. 0N/A * Writes image to output stream using given image writer.