javax.imageio
public final class ImageIO extends Object
Method Summary | |
---|---|
static ImageInputStream | createImageInputStream(Object input)
Create an image input stream from the given object. |
static ImageOutputStream | createImageOutputStream(Object output)
Create an image output stream from the given object. |
static File | getCacheDirectory()
Retrieve the current cache directory.
|
static ImageReader | getImageReader(ImageWriter writer)
Retrieve an image reader corresponding to an image writer, or
null if writer is not registered or if no corresponding reader is
registered.
|
static Iterator<ImageReader> | getImageReaders(Object input)
Retrieve an iterator over the collection of registered image
readers that support reading data from the given object.
|
static Iterator<ImageReader> | getImageReadersByFormatName(String formatName)
Retrieve an iterator over all registered readers for the given
format.
|
static Iterator<ImageReader> | getImageReadersByMIMEType(String MIMEType)
Retrieve an iterator over all registered readers for the given
MIME type.
|
static Iterator<ImageReader> | getImageReadersBySuffix(String fileSuffix)
Retrieve an iterator over all registered readers for the given
file suffix.
|
static Iterator<ImageTranscoder> | getImageTranscoders(ImageReader reader, ImageWriter writer)
Retrieve an iterator over a collection of image transcoders that
support transcoding from the given image reader's metadata format
to the given writer's metadata format.
|
static ImageWriter | getImageWriter(ImageReader reader)
Retrieve an image writer corresponding to an image reader, or
null if reader is not registered or if no corresponding writer is
registered. |
static Iterator<ImageWriter> | getImageWriters(ImageTypeSpecifier type, String formatName)
Retrieve an iterator over the collection of registered image
writers that support writing images of the given type and in the
given format.
|
static Iterator<ImageWriter> | getImageWritersByFormatName(String formatName)
Retrieve an iterator over all registered writers for the given
format.
|
static Iterator<ImageWriter> | getImageWritersByMIMEType(String MIMEType)
Retrieve an iterator over all registered writers for the given
MIME type.
|
static Iterator<ImageWriter> | getImageWritersBySuffix(String fileSuffix)
Retrieve an iterator over all registered writers for the given
file suffix.
|
static String[] | getReaderFormatNames()
Retrieve all the informal format names supported by the
collection of registered image readers.
|
static String[] | getReaderMIMETypes()
Retrieve all the MIME types supported by the collection of
registered image readers.
|
static boolean | getUseCache()
Check whether or not an on-disk cache is used for image input and
output streams.
|
static String[] | getWriterFormatNames()
Retrieve all the informal format names supported by the
collection of registered image writers.
|
static String[] | getWriterMIMETypes()
Retrieve all the MIME types supported by the collection of
registered image writers.
|
static BufferedImage | read(ImageInputStream stream)
Create a buffered image from an image input stream. |
static BufferedImage | read(URL input)
Create a buffered image from a URL. |
static BufferedImage | read(InputStream input)
Create a buffered image from an input stream. |
static BufferedImage | read(File input)
Create a buffered image from a file. |
static void | scanForPlugins()
Rescans the application classpath for ImageIO service providers
and registers them. |
static void | setCacheDirectory(File cacheDirectory)
Set the directory to be used for caching image data. |
static void | setUseCache(boolean useCache)
Control whether or not an on-disk cache is used. |
static boolean | write(RenderedImage im, String formatName, File output)
Write an image to a file using a registered writer that supports
the given format, overwriting the file if it already exists.
|
static boolean | write(RenderedImage im, String formatName, OutputStream output)
Write an image to an output stream using a registered writer that
supports the given format.
|
static boolean | write(RenderedImage im, String formatName, ImageOutputStream output)
Write an image to an ImageOutputStream using a registered writer
that supports the given format. |
Parameters: input an object from which to read image data
Returns: an ImageInputStream that can read data from input, or null
Throws: IllegalArgumentException if input is null IOException if caching is required but not enabled
Parameters: output an object to which to write image data
Returns: an ImageOutputStream that can send data to output, or null
Throws: IllegalArgumentException if output is null IOException if caching is required but not enabled
Returns: the current cache directory or null if none is set.
Parameters: writer a registered image writer
Returns: an image reader corresponding to writer, or null
Throws: IllegalArgumentException if writer is null
Parameters: input the object for which to retrieve image readers
Returns: an iterator over a collection of image readers
Parameters: formatName an infomal format name (e.g. "jpeg" or "bmp")
Returns: an iterator over a collection of image readers
Throws: IllegalArgumentException if formatName is null
Parameters: MIMEType a MIME specification for an image type (e.g. "image/jpeg" or "image/x-bmp")
Returns: an iterator over a collection of image readers
Throws: IllegalArgumentException if MIMEType is null
Parameters: fileSuffix an image file suffix (e.g. "jpg" or "bmp")
Returns: an iterator over a collection of image readers
Throws: IllegalArgumentException if fileSuffix is null
Parameters: reader an image reader writer an image writer
Returns: an iterator over a collection of image transcoders
Throws: IllegalArgumentException if either reader or writer is null
Parameters: reader a registered image reader
Returns: an image writer corresponding to reader, or null
Throws: IllegalArgumentException if reader is null
Parameters: type the output image's colour and sample models formatName the output image format
Returns: an iterator over a collection of image writers
Parameters: formatName an infomal format name (e.g. "jpeg" or "bmp")
Returns: an iterator over a collection of image writers
Throws: IllegalArgumentException if formatName is null
Parameters: MIMEType a MIME specification for an image type (e.g. "image/jpeg" or "image/x-bmp")
Returns: an iterator over a collection of image writers
Throws: IllegalArgumentException if MIMEType is null
Parameters: fileSuffix an image file suffix (e.g. "jpg" or "bmp")
Returns: an iterator over a collection of image writers
Throws: IllegalArgumentException if fileSuffix is null
Returns: an array of format names
Returns: an array of MIME types
Returns: true if an on-disk cache is available, false otherwise
Returns: an array of format names
Returns: an array of MIME types
Parameters: stream the image input stream from which to read image data
Returns: a new buffered image created from the given image data, or null
Throws: IllegalArgumentException if stream is null IOException if a reading error occurs
Parameters: input the URL from which to retrieve the image file
Returns: a new buffered image created from the given image URL, or null
Throws: IllegalArgumentException if input is null IOException if a reading error occurs
Parameters: input the input stream from which to read the image data
Returns: a new buffered image created from the given input stream, or null
Throws: IllegalArgumentException if input is null IOException if a reading error occurs
Parameters: input the file from which to read image data
Returns: a new buffered image created from the given image file, or null
Throws: IllegalArgumentException if input is null IOException if a reading error occurs
Parameters: cacheDirectory the directory where image data should be cached
Throws: IllegalArgumentException if cacheDirectory is not a directory
Parameters: useCache true to use an on-disk cache, false otherwise
Parameters: im the image data to write formatName an informal description of the output format output the file to which the image will be written
Returns: false if no registered writer supports the given format, true otherwise
Throws: IllegalArgumentException if any argument is null IOException if a writing error occurs
Parameters: im the image data to write formatName an informal description of the output format output the output stream to which the image will be written
Returns: false if no registered writer supports the given format, true otherwise
Throws: IllegalArgumentException if any argument is null IOException if a writing error occurs
Parameters: im the image data to write formatName an informal description of the output format output the image output stream to which the image will be written
Returns: false if no registered writer supports the given format, true otherwise
Throws: IllegalArgumentException if any argument is null IOException if a writing error occurs