|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.imageio.ImageIO
public final class ImageIO
An uninstantiable class that provides static methods for locating and using image readers and writers.
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(File input)
Create a buffered image from a file. |
static BufferedImage |
read(ImageInputStream stream)
Create a buffered image from an image input stream. |
static BufferedImage |
read(InputStream input)
Create a buffered image from an input stream. |
static BufferedImage |
read(URL input)
Create a buffered image from a URL. |
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,
ImageOutputStream output)
Write an image to an ImageOutputStream using a registered writer that supports the given format. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static File getCacheDirectory()
public static Iterator<ImageReader> getImageReadersByFormatName(String formatName)
formatName
- an infomal format name (e.g. "jpeg" or "bmp")
IllegalArgumentException
- if formatName is nullpublic static Iterator<ImageReader> getImageReadersByMIMEType(String MIMEType)
MIMEType
- a MIME specification for an image type
(e.g. "image/jpeg" or "image/x-bmp")
IllegalArgumentException
- if MIMEType is nullpublic static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix)
fileSuffix
- an image file suffix (e.g. "jpg" or "bmp")
IllegalArgumentException
- if fileSuffix is nullpublic static Iterator<ImageWriter> getImageWritersByFormatName(String formatName)
formatName
- an infomal format name (e.g. "jpeg" or "bmp")
IllegalArgumentException
- if formatName is nullpublic static Iterator<ImageWriter> getImageWritersByMIMEType(String MIMEType)
MIMEType
- a MIME specification for an image type
(e.g. "image/jpeg" or "image/x-bmp")
IllegalArgumentException
- if MIMEType is nullpublic static Iterator<ImageWriter> getImageWritersBySuffix(String fileSuffix)
fileSuffix
- an image file suffix (e.g. "jpg" or "bmp")
IllegalArgumentException
- if fileSuffix is nullpublic static String[] getReaderFormatNames()
public static String[] getReaderMIMETypes()
public static boolean getUseCache()
public static String[] getWriterFormatNames()
public static String[] getWriterMIMETypes()
public static void scanForPlugins()
public static void setCacheDirectory(File cacheDirectory)
cacheDirectory
- the directory where image data should be
cached
IllegalArgumentException
- if cacheDirectory is not a
directorypublic static void setUseCache(boolean useCache)
useCache
- true to use an on-disk cache, false otherwisepublic static boolean write(RenderedImage im, String formatName, File output) throws IOException
im
- the image data to writeformatName
- an informal description of the output formatoutput
- the file to which the image will be written
IllegalArgumentException
- if any argument is null
IOException
- if a writing error occurspublic static boolean write(RenderedImage im, String formatName, OutputStream output) throws IOException
im
- the image data to writeformatName
- an informal description of the output formatoutput
- the output stream to which the image will be
written
IllegalArgumentException
- if any argument is null
IOException
- if a writing error occurspublic static boolean write(RenderedImage im, String formatName, ImageOutputStream output) throws IOException
im
- the image data to writeformatName
- an informal description of the output formatoutput
- the image output stream to which the image will be
written
IllegalArgumentException
- if any argument is null
IOException
- if a writing error occurspublic static BufferedImage read(ImageInputStream stream) throws IOException
stream
- the image input stream from which to read image
data
IllegalArgumentException
- if stream is null
IOException
- if a reading error occurspublic static BufferedImage read(URL input) throws IOException
input
- the URL from which to retrieve the image file
IllegalArgumentException
- if input is null
IOException
- if a reading error occurspublic static BufferedImage read(InputStream input) throws IOException
input
- the input stream from which to read the image data
IllegalArgumentException
- if input is null
IOException
- if a reading error occurspublic static BufferedImage read(File input) throws IOException
input
- the file from which to read image data
IllegalArgumentException
- if input is null
IOException
- if a reading error occurspublic static ImageInputStream createImageInputStream(Object input) throws IOException
input
- an object from which to read image data
IllegalArgumentException
- if input is null
IOException
- if caching is required but not enabledpublic static ImageOutputStream createImageOutputStream(Object output) throws IOException
output
- an object to which to write image data
IllegalArgumentException
- if output is null
IOException
- if caching is required but not enabledpublic static ImageReader getImageReader(ImageWriter writer)
writer
- a registered image writer
IllegalArgumentException
- if writer is nullpublic static Iterator<ImageReader> getImageReaders(Object input)
input
- the object for which to retrieve image readers
public static Iterator<ImageWriter> getImageWriters(ImageTypeSpecifier type, String formatName)
type
- the output image's colour and sample modelsformatName
- the output image format
public static ImageWriter getImageWriter(ImageReader reader)
reader
- a registered image reader
IllegalArgumentException
- if reader is nullpublic static Iterator<ImageTranscoder> getImageTranscoders(ImageReader reader, ImageWriter writer)
reader
- an image readerwriter
- an image writer
IllegalArgumentException
- if either reader or writer is
null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |