|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectutilities.ImageIOGreyScale
public final class ImageIOGreyScale
A class containing static convenience methods for locating ImageReader
s and
ImageWriter
s, and performing simple encoding and decoding.
Nested Class Summary | |
---|---|
(package private) static class |
ImageIOGreyScale.CacheInfo
A class to hold information about caching. |
(package private) static class |
ImageIOGreyScale.CanDecodeInputFilter
|
(package private) static class |
ImageIOGreyScale.CanEncodeImageAndFormatFilter
|
(package private) static class |
ImageIOGreyScale.ContainsFilter
|
(package private) static class |
ImageIOGreyScale.ImageReaderIterator
|
(package private) static class |
ImageIOGreyScale.ImageTranscoderIterator
|
(package private) static class |
ImageIOGreyScale.ImageWriterIterator
|
private static class |
ImageIOGreyScale.SpiInfo
|
(package private) static class |
ImageIOGreyScale.TranscoderFilter
|
Field Summary | |
---|---|
private static java.lang.reflect.Method |
readerFileSuffixesMethod
|
private static java.lang.reflect.Method |
readerFormatNamesMethod
|
private static java.lang.reflect.Method |
readerMIMETypesMethod
|
private static javax.imageio.spi.IIORegistry |
theRegistry
|
private static java.lang.reflect.Method |
writerFileSuffixesMethod
|
private static java.lang.reflect.Method |
writerFormatNamesMethod
|
private static java.lang.reflect.Method |
writerMIMETypesMethod
|
Constructor Summary | |
---|---|
private |
ImageIOGreyScale()
Constructor is private to prevent instantiation. |
Method Summary | ||
---|---|---|
private static boolean |
contains(java.lang.String[] names,
java.lang.String name)
|
|
static javax.imageio.stream.ImageInputStream |
createImageInputStream(java.lang.Object input)
Returns an ImageInputStream that will take its input from the given Object . |
|
static javax.imageio.stream.ImageOutputStream |
createImageOutputStream(java.lang.Object output)
Returns an ImageOutputStream that will send its output to the given Object . |
|
static java.io.File |
getCacheDirectory()
Returns the current value set by setCacheDirectory , or null if no explicit
setting has been made. |
|
private static ImageIOGreyScale.CacheInfo |
getCacheInfo()
Returns the CacheInfo object associated with this ThreadGroup . |
|
static javax.imageio.ImageReader |
getImageReader(javax.imageio.ImageWriter writer)
Returns an ImageReader corresponding to the given ImageWriter , if there is
one, or null if the plug-in for this ImageWriter does not specify a
corresponding ImageReader , or if the given ImageWriter is not registered. |
|
static java.util.Iterator<javax.imageio.ImageReader> |
getImageReaders(java.lang.Object input)
Returns an Iterator containing all currently registered ImageReader s that
claim to be able to decode the supplied Object , typically an ImageInputStream
. |
|
static java.util.Iterator<javax.imageio.ImageReader> |
getImageReadersByFormatName(java.lang.String formatName)
Returns an Iterator containing all currently registered ImageReader s that
claim to be able to decode the named format. |
|
static java.util.Iterator<javax.imageio.ImageReader> |
getImageReadersByMIMEType(java.lang.String MIMEType)
Returns an Iterator containing all currently registered ImageReader s that
claim to be able to decode files with the given MIME type. |
|
static java.util.Iterator<javax.imageio.ImageReader> |
getImageReadersBySuffix(java.lang.String fileSuffix)
Returns an Iterator containing all currently registered ImageReader s that
claim to be able to decode files with the given suffix. |
|
static java.util.Iterator<javax.imageio.ImageTranscoder> |
getImageTranscoders(javax.imageio.ImageReader reader,
javax.imageio.ImageWriter writer)
Returns an Iterator containing all currently registered ImageTranscoder s that
claim to be able to transcode between the metadata of the given ImageReader and
ImageWriter . |
|
static javax.imageio.ImageWriter |
getImageWriter(javax.imageio.ImageReader reader)
Returns an ImageWriter corresponding to the given ImageReader , if there is
one, or null if the plug-in for this ImageReader does not specify a
corresponding ImageWriter , or if the given ImageReader is not registered. |
|
static java.util.Iterator<javax.imageio.ImageWriter> |
getImageWriters(javax.imageio.ImageTypeSpecifier type,
java.lang.String formatName)
Returns an Iterator containing all currently registered ImageWriter s that
claim to be able to encode images of the given layout (specified using an
ImageTypeSpecifier ) in the given format. |
|
static java.util.Iterator<javax.imageio.ImageWriter> |
getImageWritersByFormatName(java.lang.String formatName)
Returns an Iterator containing all currently registered ImageWriter s that
claim to be able to encode the named format. |
|
static java.util.Iterator<javax.imageio.ImageWriter> |
getImageWritersByMIMEType(java.lang.String MIMEType)
Returns an Iterator containing all currently registered ImageWriter s that
claim to be able to encode files with the given MIME type. |
|
static java.util.Iterator<javax.imageio.ImageWriter> |
getImageWritersBySuffix(java.lang.String fileSuffix)
Returns an Iterator containing all currently registered ImageWriter s that
claim to be able to encode files with the given suffix. |
|
static java.lang.String[] |
getReaderFileSuffixes()
Returns an array of String s listing all of the file suffixes associated with the formats
understood by the current set of registered readers. |
|
static java.lang.String[] |
getReaderFormatNames()
Returns an array of String s listing all of the informal format names understood by the
current set of registered readers. |
|
static java.lang.String[] |
getReaderMIMETypes()
Returns an array of String s listing all of the MIME types understood by the current set of
registered readers. |
|
private static
|
getReaderWriterInfo(java.lang.Class<S> spiClass,
ImageIOGreyScale.SpiInfo spiInfo)
|
|
private static java.lang.String |
getTempDir()
Returns the default temporary (cache) directory as defined by the java.io.tmpdir system property. |
|
static boolean |
getUseCache()
Returns the current value set by setUseCache , or true if no explicit setting
has been made. |
|
static java.lang.String[] |
getWriterFileSuffixes()
Returns an array of String s listing all of the file suffixes associated with the formats
understood by the current set of registered writers. |
|
static java.lang.String[] |
getWriterFormatNames()
Returns an array of String s listing all of the informal format names understood by the
current set of registered writers. |
|
static java.lang.String[] |
getWriterMIMETypes()
Returns an array of String s listing all of the MIME types understood by the current set of
registered writers. |
|
private static boolean |
hasCachePermission()
Determines whether the caller has write access to the cache directory, stores the result in the CacheInfo object, and returns the decision. |
|
static java.awt.image.BufferedImage |
read(java.io.File input)
Returns a BufferedImage as the result of decoding a supplied File with an
ImageReader chosen automatically from among those currently registered. |
|
static java.awt.image.BufferedImage |
read(javax.imageio.stream.ImageInputStream stream)
Returns a BufferedImage as the result of decoding a supplied ImageInputStream
with an ImageReader chosen automatically from among those currently registered. |
|
static java.awt.image.BufferedImage |
read(java.io.InputStream input)
Returns a BufferedImage as the result of decoding a supplied InputStream with
an ImageReader chosen automatically from among those currently registered. |
|
static java.awt.image.BufferedImage |
read(java.net.URL input)
Returns a BufferedImage as the result of decoding a supplied URL with an
ImageReader chosen automatically from among those currently registered. |
|
static void |
scanForPlugins()
Scans for plug-ins on the application class path, loads their service provider classes, and registers a service provider instance for each one found with the IIORegistry . |
|
static void |
setCacheDirectory(java.io.File cacheDirectory)
Sets the directory where cache files are to be created. |
|
static void |
setUseCache(boolean useCache)
Sets a flag indicating whether a disk-based cache file should be used when creating ImageInputStream s and ImageOutputStream s. |
|
static boolean |
write(java.awt.image.RenderedImage im,
java.lang.String formatName,
java.io.File output)
Writes an image using an arbitrary ImageWriter that supports the given format to a
File . |
|
static boolean |
write(java.awt.image.RenderedImage im,
java.lang.String formatName,
javax.imageio.stream.ImageOutputStream output)
Writes an image using the an arbitrary ImageWriter that supports the given format to an
ImageOutputStream . |
|
static boolean |
write(java.awt.image.RenderedImage im,
java.lang.String formatName,
java.io.OutputStream output)
Writes an image using an arbitrary ImageWriter that supports the given format to an
OutputStream . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final javax.imageio.spi.IIORegistry theRegistry
private static java.lang.reflect.Method readerFormatNamesMethod
private static java.lang.reflect.Method readerFileSuffixesMethod
private static java.lang.reflect.Method readerMIMETypesMethod
private static java.lang.reflect.Method writerFormatNamesMethod
private static java.lang.reflect.Method writerFileSuffixesMethod
private static java.lang.reflect.Method writerMIMETypesMethod
Constructor Detail |
---|
private ImageIOGreyScale()
Method Detail |
---|
public static void scanForPlugins()
IIORegistry
.
This method is needed because the application class path can theoretically change, or additional plug-ins may become available. Rather than re-scanning the classpath on every invocation of the API, the class path is scanned automatically only on the first invocation. Clients can call this method to prompt a re-scan. Thus this method need only be invoked by sophisticated applications which dynamically make new plug-ins available at runtime.
The getResources
method of the context ClassLoader
is used locate JAR files
containing files named META-INF/services/javax.imageio.spi.
classname, where
classname is one of ImageReaderSpi
, ImageWriterSpi
,
ImageTranscoderSpi
, ImageInputStreamSpi
, or ImageOutputStreamSpi
, along the application class path.
The contents of the located files indicate the names of actual implementation classes which implement the aforementioned service provider interfaces; the default class loader is then used to load each of these classes and to instantiate an instance of each class, which is then placed into the registry for later retrieval.
The exact set of locations searched depends on the implementation of the Java runtime enviroment.
ClassLoader.getResources(java.lang.String)
private static ImageIOGreyScale.CacheInfo getCacheInfo()
CacheInfo
object associated with this ThreadGroup
.
private static java.lang.String getTempDir()
private static boolean hasCachePermission()
CacheInfo
object, and returns the decision. This method helps to prevent mysterious
SecurityExceptions to be thrown when this convenience class is used in an applet, for example.
public static void setUseCache(boolean useCache)
ImageInputStream
s and ImageOutputStream
s.
When reading from a standard InputStream
>, it may be necessary to save previously read
information in a cache since the underlying stream does not allow data to be re-read. Similarly, when
writing to a standard OutputStream
, a cache may be used to allow a previously written
value to be changed before flushing it to the final destination.
The cache may reside in main memory or on disk. Setting this flag to false
disallows the
use of disk for future streams, which may be advantageous when working with small images, as the
overhead of creating and destroying files is removed.
On startup, the value is set to true
.
useCache
- a boolean
indicating whether a cache file should be used, in cases where it is
optional.getUseCache()
public static boolean getUseCache()
setUseCache
, or true
if no explicit setting
has been made.
ImageInputStream
s and
ImageOutputStream
s.setUseCache(boolean)
public static void setCacheDirectory(java.io.File cacheDirectory)
null
indicates that the
system-dependent default temporary-file directory is to be used. If getUseCache
returns
false, this value is ignored.
cacheDirectory
- a File
specifying a directory.
java.lang.SecurityException
- if the security manager denies access to the directory.
java.lang.IllegalArgumentException
- if cacheDir
is non-null
but is not a directory.File.createTempFile(String, String, File)
,
getCacheDirectory()
public static java.io.File getCacheDirectory()
setCacheDirectory
, or null
if no explicit
setting has been made.
File
indicating the directory where cache files will be created, or
null
to indicate the system-dependent default temporary-file directory.setCacheDirectory(java.io.File)
public static javax.imageio.stream.ImageInputStream createImageInputStream(java.lang.Object input) throws java.io.IOException
ImageInputStream
that will take its input from the given Object
.
The set of ImageInputStreamSpi
s registered with the IIORegistry
class is
queried and the first one that is able to take input from the supplied object is used to create the
returned ImageInputStream
. If no suitable ImageInputStreamSpi
exists,
null
is returned.
The current cache settings from getUseCache
and getCacheDirectory
will be used
to control caching.
input
- an Object
to be used as an input source, such as a File
, readable
RandomAccessFile
, or InputStream
.
ImageInputStream
, or null
.
java.lang.IllegalArgumentException
- if input
is null
.
java.io.IOException
- if a cache file is needed but cannot be created.ImageInputStreamSpi
public static javax.imageio.stream.ImageOutputStream createImageOutputStream(java.lang.Object output) throws java.io.IOException
ImageOutputStream
that will send its output to the given Object
.
The set of ImageOutputStreamSpi
s registered with the IIORegistry
class is
queried and the first one that is able to send output from the supplied object is used to create the
returned ImageOutputStream
. If no suitable ImageOutputStreamSpi
exists,
null
is returned.
The current cache settings from getUseCache
and getCacheDirectory
will be used
to control caching.
output
- an Object
to be used as an output destination, such as a File
,
writable RandomAccessFile
, or OutputStream
.
ImageOutputStream
, or null
.
java.lang.IllegalArgumentException
- if output
is null
.
java.io.IOException
- if a cache file is needed but cannot be created.ImageOutputStreamSpi
private static <S extends javax.imageio.spi.ImageReaderWriterSpi> java.lang.String[] getReaderWriterInfo(java.lang.Class<S> spiClass, ImageIOGreyScale.SpiInfo spiInfo)
public static java.lang.String[] getReaderFormatNames()
String
s listing all of the informal format names understood by the
current set of registered readers.
String
s.public static java.lang.String[] getReaderMIMETypes()
String
s listing all of the MIME types understood by the current set of
registered readers.
String
s.public static java.lang.String[] getReaderFileSuffixes()
String
s listing all of the file suffixes associated with the formats
understood by the current set of registered readers.
String
s.public static java.util.Iterator<javax.imageio.ImageReader> getImageReaders(java.lang.Object input)
Iterator
containing all currently registered ImageReader
s that
claim to be able to decode the supplied Object
, typically an ImageInputStream
.
The stream position is left at its prior position upon exit from this method.
input
- an ImageInputStream
or other Object
containing encoded image data.
Iterator
containing ImageReader
s.
java.lang.IllegalArgumentException
- if input
is null
.ImageReaderSpi.canDecodeInput(java.lang.Object)
public static java.util.Iterator<javax.imageio.ImageReader> getImageReadersByFormatName(java.lang.String formatName)
Iterator
containing all currently registered ImageReader
s that
claim to be able to decode the named format.
formatName
- a String
containing the informal name of a format (e.g., "jpeg" or
"tiff".
Iterator
containing ImageReader
s.
java.lang.IllegalArgumentException
- if formatName
is null
.ImageReaderWriterSpi.getFormatNames()
public static java.util.Iterator<javax.imageio.ImageReader> getImageReadersBySuffix(java.lang.String fileSuffix)
Iterator
containing all currently registered ImageReader
s that
claim to be able to decode files with the given suffix.
fileSuffix
- a String
containing a file suffix (e.g., "jpg" or "tiff").
Iterator
containing ImageReader
s.
java.lang.IllegalArgumentException
- if fileSuffix
is null
.ImageReaderWriterSpi.getFileSuffixes()
public static java.util.Iterator<javax.imageio.ImageReader> getImageReadersByMIMEType(java.lang.String MIMEType)
Iterator
containing all currently registered ImageReader
s that
claim to be able to decode files with the given MIME type.
MIMEType
- a String
containing a file suffix (e.g., "image/jpeg" or "image/x-bmp").
Iterator
containing ImageReader
s.
java.lang.IllegalArgumentException
- if MIMEType
is null
.ImageReaderWriterSpi.getMIMETypes()
public static java.lang.String[] getWriterFormatNames()
String
s listing all of the informal format names understood by the
current set of registered writers.
String
s.public static java.lang.String[] getWriterMIMETypes()
String
s listing all of the MIME types understood by the current set of
registered writers.
String
s.public static java.lang.String[] getWriterFileSuffixes()
String
s listing all of the file suffixes associated with the formats
understood by the current set of registered writers.
String
s.private static boolean contains(java.lang.String[] names, java.lang.String name)
public static java.util.Iterator<javax.imageio.ImageWriter> getImageWritersByFormatName(java.lang.String formatName)
Iterator
containing all currently registered ImageWriter
s that
claim to be able to encode the named format.
formatName
- a String
containing the informal name of a format (e.g., "jpeg" or
"tiff".
Iterator
containing ImageWriter
s.
java.lang.IllegalArgumentException
- if formatName
is null
.ImageReaderWriterSpi.getFormatNames()
public static java.util.Iterator<javax.imageio.ImageWriter> getImageWritersBySuffix(java.lang.String fileSuffix)
Iterator
containing all currently registered ImageWriter
s that
claim to be able to encode files with the given suffix.
fileSuffix
- a String
containing a file suffix (e.g., "jpg" or "tiff").
Iterator
containing ImageWriter
s.
java.lang.IllegalArgumentException
- if fileSuffix
is null
.ImageReaderWriterSpi.getFileSuffixes()
public static java.util.Iterator<javax.imageio.ImageWriter> getImageWritersByMIMEType(java.lang.String MIMEType)
Iterator
containing all currently registered ImageWriter
s that
claim to be able to encode files with the given MIME type.
MIMEType
- a String
containing a file suffix (e.g., "image/jpeg" or "image/x-bmp").
Iterator
containing ImageWriter
s.
java.lang.IllegalArgumentException
- if MIMEType
is null
.ImageReaderWriterSpi.getMIMETypes()
public static javax.imageio.ImageWriter getImageWriter(javax.imageio.ImageReader reader)
ImageWriter
corresponding to the given ImageReader
, if there is
one, or null
if the plug-in for this ImageReader
does not specify a
corresponding ImageWriter
, or if the given ImageReader
is not registered.
This mechanism may be used to obtain an ImageWriter
that will understand the internal
structure of non-pixel metadata (as encoded by IIOMetadata
objects) generated by the
ImageReader
. By obtaining this data from the ImageReader
and passing it on to
the ImageWriter
obtained with this method, a client program can read an image, modify it
in some way, and write it back out preserving all metadata, without having to understand anything about
the structure of the metadata, or even about the image format. Note that this method returns the
"preferred" writer, which is the first in the list returned by
javax.imageio.spi.ImageReaderSpi.getImageWriterSpiNames()
.
reader
- an instance of a registered ImageReader
.
ImageWriter
, or null.
java.lang.IllegalArgumentException
- if reader
is null
.getImageReader(ImageWriter)
,
ImageReaderSpi.getImageWriterSpiNames()
public static javax.imageio.ImageReader getImageReader(javax.imageio.ImageWriter writer)
ImageReader
corresponding to the given ImageWriter
, if there is
one, or null
if the plug-in for this ImageWriter
does not specify a
corresponding ImageReader
, or if the given ImageWriter
is not registered.
This method is provided principally for symmetry with getImageWriter(ImageReader)
. Note
that this method returns the "preferred" reader, which is the first in the list returned by
javax.imageio.spi.ImageWriterSpi.getImageReaderSpiNames()
.
writer
- an instance of a registered ImageWriter
.
ImageReader
, or null.
java.lang.IllegalArgumentException
- if writer
is null
.getImageWriter(ImageReader)
,
ImageWriterSpi.getImageReaderSpiNames()
public static java.util.Iterator<javax.imageio.ImageWriter> getImageWriters(javax.imageio.ImageTypeSpecifier type, java.lang.String formatName)
Iterator
containing all currently registered ImageWriter
s that
claim to be able to encode images of the given layout (specified using an
ImageTypeSpecifier
) in the given format.
type
- an ImageTypeSpecifier
indicating the layout of the image to be written.formatName
- the informal name of the format
.
Iterator
containing ImageWriter
s.
java.lang.IllegalArgumentException
- if any parameter is null
.ImageWriterSpi.canEncodeImage(ImageTypeSpecifier)
public static java.util.Iterator<javax.imageio.ImageTranscoder> getImageTranscoders(javax.imageio.ImageReader reader, javax.imageio.ImageWriter writer)
Iterator
containing all currently registered ImageTranscoder
s that
claim to be able to transcode between the metadata of the given ImageReader
and
ImageWriter
.
reader
- an ImageReader
.writer
- an ImageWriter
.
Iterator
containing ImageTranscoder
s.
java.lang.IllegalArgumentException
- if reader
or writer
is null
.public static java.awt.image.BufferedImage read(java.io.File input) throws java.io.IOException
BufferedImage
as the result of decoding a supplied File
with an
ImageReader
chosen automatically from among those currently registered. The
File
is wrapped in an ImageInputStream
. If no registered
ImageReader
claims to be able to read the resulting stream, null
is returned.
The current cache settings from getUseCache
and getCacheDirectory
will be used
to control caching in the ImageInputStream
that is created.
Note that there is no read
method that takes a filename as a String
; use this
method instead after creating a File
from the filename.
This method does not attempt to locate ImageReader
s that can read directly from a
File
; that may be accomplished using IIORegistry
and
ImageReaderSpi
.
input
- a File
to read from.
BufferedImage
containing the decoded contents of the input, or null
.
java.lang.IllegalArgumentException
- if input
is null
.
java.io.IOException
- if an error occurs during reading.public static java.awt.image.BufferedImage read(java.io.InputStream input) throws java.io.IOException
BufferedImage
as the result of decoding a supplied InputStream
with
an ImageReader
chosen automatically from among those currently registered. The
InputStream
is wrapped in an ImageInputStream
. If no registered
ImageReader
claims to be able to read the resulting stream, null
is returned.
The current cache settings from getUseCache
and getCacheDirectory
will be used
to control caching in the ImageInputStream
that is created.
This method does not attempt to locate ImageReader
s that can read directly from an
InputStream
; that may be accomplished using IIORegistry
and
ImageReaderSpi
.
This method does not close the provided InputStream
after the read operation has
completed; it is the responsibility of the caller to close the stream, if desired.
input
- an InputStream
to read from.
BufferedImage
containing the decoded contents of the input, or null
.
java.lang.IllegalArgumentException
- if input
is null
.
java.io.IOException
- if an error occurs during reading.public static java.awt.image.BufferedImage read(java.net.URL input) throws java.io.IOException
BufferedImage
as the result of decoding a supplied URL
with an
ImageReader
chosen automatically from among those currently registered. An
InputStream
is obtained from the URL
, which is wrapped in an
ImageInputStream
. If no registered ImageReader
claims to be able to read the
resulting stream, null
is returned.
The current cache settings from getUseCache
and getCacheDirectory
will be used
to control caching in the ImageInputStream
that is created.
This method does not attempt to locate ImageReader
s that can read directly from a
URL
; that may be accomplished using IIORegistry
and
ImageReaderSpi
.
input
- a URL
to read from.
BufferedImage
containing the decoded contents of the input, or null
.
java.lang.IllegalArgumentException
- if input
is null
.
java.io.IOException
- if an error occurs during reading.public static java.awt.image.BufferedImage read(javax.imageio.stream.ImageInputStream stream) throws java.io.IOException
BufferedImage
as the result of decoding a supplied ImageInputStream
with an ImageReader
chosen automatically from among those currently registered. If no
registered ImageReader
claims to be able to read the stream, null
is
returned.
Unlike most other methods in this class, this method does close the provided
ImageInputStream
after the read operation has completed, unless null
is
returned, in which case this method does not close the stream.
stream
- an ImageInputStream
to read from.
BufferedImage
containing the decoded contents of the input, or null
.
java.lang.IllegalArgumentException
- if stream
is null
.
java.io.IOException
- if an error occurs during reading.public static boolean write(java.awt.image.RenderedImage im, java.lang.String formatName, javax.imageio.stream.ImageOutputStream output) throws java.io.IOException
ImageWriter
that supports the given format to an
ImageOutputStream
. The image is written to the ImageOutputStream
starting at
the current stream pointer, overwriting existing stream data from that point forward, if present.
This method does not close the provided ImageOutputStream
after the write
operation has completed; it is the responsibility of the caller to close the stream, if desired.
im
- a RenderedImage
to be written.formatName
- a String
containg the informal name of the format.output
- an ImageOutputStream
to be written to.
false
if no appropriate writer is found.
java.lang.IllegalArgumentException
- if any parameter is null
.
java.io.IOException
- if an error occurs during writing.public static boolean write(java.awt.image.RenderedImage im, java.lang.String formatName, java.io.File output) throws java.io.IOException
ImageWriter
that supports the given format to a
File
. If there is already a File
present, its contents are discarded.
im
- a RenderedImage
to be written.formatName
- a String
containg the informal name of the format.output
- a File
to be written to.
false
if no appropriate writer is found.
java.lang.IllegalArgumentException
- if any parameter is null
.
java.io.IOException
- if an error occurs during writing.public static boolean write(java.awt.image.RenderedImage im, java.lang.String formatName, java.io.OutputStream output) throws java.io.IOException
ImageWriter
that supports the given format to an
OutputStream
.
This method does not close the provided OutputStream
after the write operation
has completed; it is the responsibility of the caller to close the stream, if desired.
The current cache settings from getUseCache
and getCacheDirectory
will be used
to control caching.
im
- a RenderedImage
to be written.formatName
- a String
containg the informal name of the format.output
- an OutputStream
to be written to.
false
if no appropriate writer is found.
java.lang.IllegalArgumentException
- if any parameter is null
.
java.io.IOException
- if an error occurs during writing.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |