java.lang.Object javax.imageio.ImageWriter
An abstract superclass for encoding and writing images. This class must be subclassed by classes that write out images in the context of the Java Image I/O framework.
ImageWriter objects are normally instantiated by the service provider class for the specific format. Service provider classes are registered with the IIORegistry, which uses them for format recognition and presentation of available format readers and writers.
Field Summary | |
---|---|
protected Locale [] |
availableLocales
An array of Locales that may be used to localize warning messages and compression setting values, or null if localization is not supported. |
protected Locale |
locale
The current Locale to be used for localization, or null if none has been set. |
protected ImageWriterSpi |
originatingProvider
The ImageWriterSpi that instantiated this object, or null if its identity is not known or none exists. |
protected Object |
output
The ImageOutputStream or other Object set by setOutput and retrieved by getOutput. |
protected List |
progressListeners
A List of currently registered IIOWriteProgressListeners, initialized by default null, which is synonymous with an empty List. |
protected List |
warningListeners
A List of currently registered IIOWriteWarningListeners, initialized by default to null, which is synonymous with an empty List. |
protected List |
warningLocales
A List of Locales, one for each element of warningListeners, initialized by default null, which is synonymous with an empty List. |
Constructor Summary | |
---|---|
protected |
ImageWriter
(
ImageWriterSpi
originatingProvider) Constructs an ImageWriter and sets its originatingProvider instance variable to the supplied value. |
Method Summary | |
---|---|
void |
abort
() Requests that any current write operation be aborted. |
protected boolean |
abortRequested
() Returns true if a request to abort the current write operation has been made since the writer was instantiated or clearAbortRequest was called. |
void |
addIIOWriteProgressListener
(
IIOWriteProgressListener
listener) Adds an IIOWriteProgressListener to the list of registered progress listeners. |
void |
addIIOWriteWarningListener
(
IIOWriteWarningListener
listener) Adds an IIOWriteWarningListener to the list of registered warning listeners. |
boolean |
canInsertEmpty
(int imageIndex) Returns true if the writer supports the insertion of a new, empty image at the given index. |
boolean |
canInsertImage
(int imageIndex) Returns true if the writer supports the insertion of a new image at the given index. |
boolean |
canRemoveImage
(int imageIndex) Returns true if the writer supports the removal of an existing image at the given index. |
boolean |
canReplaceImageMetadata
(int imageIndex) Returns true if it is possible to replace the image metadata associated with an existing image with index imageIndex. |
boolean |
canReplacePixels
(int imageIndex) Returns true if the writer allows pixels of the given image to be replaced using the replacePixels methods. |
boolean |
canReplaceStreamMetadata
() Returns true if it is possible to replace the stream metadata already present in the output. |
boolean |
canWriteEmpty
() Returns true if the writer supports the writing of a complete image stream consisting of a single image with undefined pixel values and associated metadata and thumbnails to the output. |
boolean |
canWriteRasters
() Returns true if the methods that take an IIOImage parameter are capable of dealing with a Raster (as opposed to RenderedImage) source image. |
boolean |
canWriteSequence
() Returns true if the writer is able to append an image to an image stream that already contains header information and possibly prior images. |
protected void |
clearAbortRequest
() Clears any previous abort request. |
abstract IIOMetadata |
convertImageMetadata
(
IIOMetadata
inData,
ImageTypeSpecifier
imageType,
ImageWriteParam
param) Returns an IIOMetadata object that may be used for encoding and optionally modified using its document interfaces or other interfaces specific to the writer plug-in that will be used for encoding. |
abstract IIOMetadata |
convertStreamMetadata
(
IIOMetadata
inData,
ImageWriteParam
param) Returns an IIOMetadata object that may be used for encoding and optionally modified using its document interfaces or other interfaces specific to the writer plug-in that will be used for encoding. |
void |
dispose
() Allows any resources held by this object to be released. |
void |
endInsertEmpty
() Completes the insertion of a new image that was begun with a prior call to prepareInsertEmpty. |
void |
endReplacePixels
() Terminates a sequence of calls to replacePixels. |
void |
endWriteEmpty
() Completes the writing of a new image that was begun with a prior call to prepareWriteEmpty. |
void |
endWriteSequence
() Completes the writing of a sequence of images begun with prepareWriteSequence. |
Locale [] |
getAvailableLocales
() Returns an array of Locales that may be used to localize warning listeners and compression settings. |
abstract IIOMetadata |
getDefaultImageMetadata
(
ImageTypeSpecifier
imageType,
ImageWriteParam
param) Returns an IIOMetadata object containing default values for encoding an image of the given type. |
abstract IIOMetadata |
getDefaultStreamMetadata
(
ImageWriteParam
param) Returns an IIOMetadata object containing default values for encoding a stream of images. |
ImageWriteParam |
getDefaultWriteParam
() Returns a new ImageWriteParam object of the appropriate type for this file format containing default values, that is, those values that would be used if no ImageWriteParam object were specified. |
Locale |
getLocale
() Returns the currently set Locale, or null if none has been set. |
int |
getNumThumbnailsSupported
(
ImageTypeSpecifier
imageType,
ImageWriteParam
param,
IIOMetadata
streamMetadata,
IIOMetadata
imageMetadata) Returns the number of thumbnails suported by the format being written, given the image type and any additional write parameters and metadata objects that will be used during encoding. |
ImageWriterSpi |
getOriginatingProvider
() Returns the ImageWriterSpi object that created this ImageWriter, or null if this object was not created through the IIORegistry. |
Object |
getOutput
() Returns the ImageOutputStream or other Object set by the most recent call to the setOutput method. |
Dimension [] |
getPreferredThumbnailSizes
(
ImageTypeSpecifier
imageType,
ImageWriteParam
param,
IIOMetadata
streamMetadata,
IIOMetadata
imageMetadata) Returns an array of Dimensions indicating the legal size ranges for thumbnail images as they will be encoded in the output file or stream. |
void |
prepareInsertEmpty
(int imageIndex,
ImageTypeSpecifier
imageType, int width, int height,
IIOMetadata
imageMetadata,
List
thumbnails,
ImageWriteParam
param) Begins the insertion of a new image with undefined pixel values into an existing image stream. |
void |
prepareReplacePixels
(int imageIndex,
Rectangle
region) Prepares the writer to handle a series of calls to the replacePixels methods. |
void |
prepareWriteEmpty
(
IIOMetadata
streamMetadata,
ImageTypeSpecifier
imageType, int width, int height,
IIOMetadata
imageMetadata,
List
thumbnails,
ImageWriteParam
param) Begins the writing of a complete image stream, consisting of a single image with undefined pixel values and associated metadata and thumbnails, to the output. |
void |
prepareWriteSequence
(
IIOMetadata
streamMetadata) Prepares a stream to accept a series of subsequent writeToSequence calls, using the provided stream metadata object. |
protected void |
processImageComplete
() Broadcasts the completion of an image write to all registered IIOWriteProgressListeners by calling their imageComplete method. |
protected void |
processImageProgress
(float percentageDone) Broadcasts the current percentage of image completion to all registered IIOWriteProgressListeners by calling their imageProgress method. |
protected void |
processImageStarted
(int imageIndex) Broadcasts the start of an image write to all registered IIOWriteProgressListeners by calling their imageStarted method. |
protected void |
processThumbnailComplete
() Broadcasts the completion of a thumbnail write to all registered IIOWriteProgressListeners by calling their thumbnailComplete method. |
protected void |
processThumbnailProgress
(float percentageDone) Broadcasts the current percentage of thumbnail completion to all registered IIOWriteProgressListeners by calling their thumbnailProgress method. |
protected void |
processThumbnailStarted
(int imageIndex, int thumbnailIndex) Broadcasts the start of a thumbnail write to all registered IIOWriteProgressListeners by calling their thumbnailStarted method. |
protected void |
processWarningOccurred
(int imageIndex,
String
warning) Broadcasts a warning message to all registered IIOWriteWarningListeners by calling their warningOccurred method. |
protected void |
processWarningOccurred
(int imageIndex,
String
baseName,
String
keyword) Broadcasts a localized warning message to all registered IIOWriteWarningListeners by calling their warningOccurred method with a string taken from a ResourceBundle. |
protected void |
processWriteAborted
() Broadcasts that the write has been aborted to all registered IIOWriteProgressListeners by calling their writeAborted method. |
void |
removeAllIIOWriteProgressListeners
() Removes all currently registered IIOWriteProgressListener objects. |
void |
removeAllIIOWriteWarningListeners
() Removes all currently registered IIOWriteWarningListener objects. |
void |
removeIIOWriteProgressListener
(
IIOWriteProgressListener
listener) Removes an IIOWriteProgressListener from the list of registered progress listeners. |
void |
removeIIOWriteWarningListener
(
IIOWriteWarningListener
listener) Removes an IIOWriteWarningListener from the list of registered warning listeners. |
void |
removeImage
(int imageIndex) Removes an image from the stream. |
void |
replaceImageMetadata
(int imageIndex,
IIOMetadata
imageMetadata) Replaces the image metadata associated with an existing image. |
void |
replacePixels
(
Raster
raster,
ImageWriteParam
param) Replaces a portion of an image already present in the output with a portion of the given Raster. |
void |
replacePixels
(
RenderedImage
image,
ImageWriteParam
param) Replaces a portion of an image already present in the output with a portion of the given image. |
void |
replaceStreamMetadata
(
IIOMetadata
streamMetadata) Replaces the stream metadata in the output with new information. |
void |
reset
() Restores the ImageWriter to its initial state. |
void |
setLocale
(
Locale
locale) Sets the current Locale of this ImageWriter to the given value. |
void |
setOutput
(
Object
output) Sets the destination to the given ImageOutputStream or other Object. |
void |
write
(
IIOImage
image) Appends a complete image stream containing a single image with default metadata and thumbnails to the output. |
abstract void |
write
(
IIOMetadata
streamMetadata,
IIOImage
image,
ImageWriteParam
param) Appends a complete image stream containing a single image and associated stream and image metadata and thumbnails to the output. |
void |
write
(
RenderedImage
image) Appends a complete image stream consisting of a single image with default metadata and thumbnails to the output. |
void |
writeInsert
(int imageIndex,
IIOImage
image,
ImageWriteParam
param) Inserts a new image into an existing image stream. |
void |
writeToSequence
(
IIOImage
image,
ImageWriteParam
param) Appends a single image and possibly associated metadata and thumbnails, to the output. |
Methods inherited from class java.lang. Object |
---|
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
Field Detail |
---|
protected ImageWriterSpi originatingProvider
protected Object output
protected Locale[] availableLocales
protected Locale locale
protected List warningListeners
protected List warningLocales
protected List progressListeners
Constructor Detail |
---|
protected ImageWriter(ImageWriterSpi originatingProvider)
Subclasses that make use of extensions should provide a constructor with signature (ImageWriterSpi, Object) in order to retrieve the extension object. If the extension object is unsuitable, an IllegalArgumentException should be thrown.
Method Detail |
---|
public ImageWriterSpi getOriginatingProvider()
The default implementation returns the value of the originatingProvider instance variable.
public void setOutput(Object output)
If output is an ImageOutputStream, calls to the write, writeToSequence, and prepareWriteEmpty/endWriteEmpty methods will preserve the existing contents of the stream. Other write methods, such as writeInsert, replaceStreamMetadata, replaceImageMetadata, replacePixels, prepareInsertEmpty/endInsertEmpty, and endWriteSequence, require the full contents of the stream to be readable and writable, and may alter any portion of the stream.
Use of a general Object other than an ImageOutputStream is intended for writers that interact directly with an output device or imaging protocol. The set of legal classes is advertised by the writer's service provider's getOutputTypes method; most writers will return a single-element array containing only ImageOutputStream.class to indicate that they accept only an ImageOutputStream.
The default implementation sets the output instance variable to the value of output after checking output against the set of classes advertised by the originating provider, if there is one.
public Object getOutput()
The default implementation returns the value of the output instance variable.
public Locale[] getAvailableLocales()
The default implementation returns a clone of the availableLocales instance variable if it is non-null, or else returns null.
public void setLocale(Locale locale)
The default implementation checks locale against the values returned by getAvailableLocales, and sets the locale instance variable if it is found. If locale is null, the instance variable is set to null without any checking.
public Locale getLocale()
The default implementation returns the value of the locale instance variable.
public ImageWriteParam getDefaultWriteParam()
The default implementation constructs and returns a new ImageWriteParam object that does not allow tiling, progressive encoding, or compression, and that will be localized for the current Locale ( i.e. , what you would get by calling new ImageWriteParam(getLocale()).
Individual plug-ins may return an instance of ImageWriteParam with additional optional features enabled, or they may return an instance of a plug-in specific subclass of ImageWriteParam.
public abstract IIOMetadata getDefaultStreamMetadata(ImageWriteParam param)
An optional ImageWriteParam may be supplied for cases where it may affect the structure of the stream metadata.
If the supplied ImageWriteParam contains optional setting values not supported by this
writer (
e.g.
progressive encoding or any format-specific settings),
writer,
they will be ignored.
Writers that do not make use of stream metadata ( e.g. , writers for single-image formats) should return null.
public abstract IIOMetadata getDefaultImageMetadata(ImageTypeSpecifier imageType, ImageWriteParam param)
An optional ImageWriteParam may be supplied for cases where it may affect the structure of the image metadata.
If the supplied ImageWriteParam contains optional setting values not supported by this
writer (
e.g.
progressive encoding or any format-specific settings),
writer,
they will be ignored.
public abstract IIOMetadata convertStreamMetadata(IIOMetadata inData, ImageWriteParam param)
An optional ImageWriteParam may be supplied for cases where it may affect the structure of the stream metadata.
If the supplied ImageWriteParam contains optional setting values not understood by this writer or transcoder, they will be ignored.
public abstract IIOMetadata convertImageMetadata(IIOMetadata inData, ImageTypeSpecifier imageType, ImageWriteParam param)
An optional ImageWriteParam may be supplied for cases where it may affect the structure of the image metadata.
If the supplied ImageWriteParam contains optional setting values not understood by this writer or transcoder, they will be ignored.
public int getNumThumbnailsSupported(ImageTypeSpecifier imageType, ImageWriteParam param, IIOMetadata streamMetadata, IIOMetadata imageMetadata)
An ImageWriteParam may optionally be supplied for cases where it may affect thumbnail handling.
If the supplied ImageWriteParam contains optional setting values not supported by this
writer (
e.g.
progressive encoding or any format-specific settings),
writer,
they will be ignored.
The default implementation returns 0.
public Dimension[] getPreferredThumbnailSizes(ImageTypeSpecifier imageType, ImageWriteParam param, IIOMetadata streamMetadata, IIOMetadata imageMetadata)
The information is returned as a set of pairs; the first element of a pair contains an (inclusive) minimum width and height, and the second element contains an (inclusive) maximum width and height. Together, each pair defines a valid range of sizes. To specify a fixed size, the same width and height will appear for both elements. A return value of null indicates that the size is arbitrary or unknown.
An ImageWriteParam may optionally be supplied for cases where it may affect thumbnail handling.
If the supplied ImageWriteParam contains optional setting values not supported by this
writer (
e.g.
progressive encoding or any format-specific settings),
writer,
they will be ignored.
The default implementation returns null.
public boolean canWriteRasters()
The default implementation returns false.
public abstract void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) throws IOException
The output must have been set beforehand using the setOutput method.
Stream metadata may optionally be supplied; if it is null, default stream metadata will be used.
If canWriteRasters returns true, the IIOImage may contain a Raster source. Otherwise, it must contain a RenderedImage source.
The supplied thumbnails will be resized if needed, and any thumbnails in excess of the supported number will be ignored. If the format requires additional thumbnails that are not provided, the writer should generate them internally.
An ImageWriteParam may optionally be supplied to control the writing process. If param is null, a default write param will be used.
If the supplied ImageWriteParam contains optional setting values not supported by this
writer (
e.g.
progressive encoding or any format-specific settings),
writer,
they will be ignored.
public void write(IIOImage image) throws IOException
public void write(RenderedImage image) throws IOException
public boolean canWriteSequence()
If canWriteSequence returns false, writeToSequence and endWriteSequence will throw an UnsupportedOperationException.
The default implementation returns false.
public void prepareWriteSequence(IIOMetadata streamMetadata) throws IOException
If the output is an ImageOutputStream, the existing contents of the output prior to the current seek position are flushed, and need not be readable or writable. If the format requires that endWriteSequence be able to rewind to patch up the header information, such as for a sequence of images in a single TIFF file, then the metadata written by this method must remain in a writable portion of the stream. Other formats may flush the stream after this method and after each image.
If canWriteSequence returns false, this method will throw an UnsupportedOperationException.
The output must have been set beforehand using either the setOutput method.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public void writeToSequence(IIOImage image, ImageWriteParam param) throws IOException
If canWriteSequence returns false, this method will throw an UnsupportedOperationException.
The output must have been set beforehand using the setOutput method.
prepareWriteSequence must have been called beforehand, or an IllegalStateException is thrown.
If canWriteRasters returns true, the IIOImage may contain a Raster source. Otherwise, it must contain a RenderedImage source.
The supplied thumbnails will be resized if needed, and any thumbnails in excess of the supported number will be ignored. If the format requires additional thumbnails that are not provided, the writer will generate them internally.
An ImageWriteParam may optionally be supplied to control the writing process. If param is null, a default write param will be used.
If the supplied ImageWriteParam contains optional setting values not supported by this
writer (
e.g.
progressive encoding or any format-specific settings),
writer,
they will be ignored.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public void endWriteSequence() throws IOException
If canWriteSequence returns false, this method will throw an UnsupportedOperationException.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public boolean canReplaceStreamMetadata() throws IOException
The default implementation throws an IllegalStateException if the output is null, and otherwise returns false.
public void replaceStreamMetadata(IIOMetadata streamMetadata) throws IOException
If canReplaceStreamMetadata returns false, an UnsupportedOperationException will be thrown.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public boolean canReplaceImageMetadata(int imageIndex) throws IOException
A writer that does not support any image metadata replacement may return false without performing bounds checking on the index.
The default implementation throws an IllegalStateException if the output is null, and otherwise returns false without checking the value of imageIndex.
public void replaceImageMetadata(int imageIndex, IIOMetadata imageMetadata) throws IOException
If canReplaceImageMetadata(imageIndex) returns false, an UnsupportedOperationException will be thrown.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public boolean canInsertImage(int imageIndex) throws IOException
A writer that does not support any image insertion may return false without performing bounds checking on the index.
The default implementation throws an IllegalStateException if the output is null, and otherwise returns false withour checking the value of imageIndex.
public void writeInsert(int imageIndex, IIOImage image, ImageWriteParam param) throws IOException
If canInsertImage(imageIndex) returns false, an UnsupportedOperationException will be thrown.
An ImageWriteParam may optionally be supplied to control the writing process. If param is null, a default write param will be used.
If the supplied ImageWriteParam contains optional setting values not supported by this
writer (
e.g.
progressive encoding or any format-specific settings),
writer,
they will be ignored.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public boolean canRemoveImage(int imageIndex) throws IOException
A writer that does not support any image removal may return false without performing bounds checking on the index.
The default implementation throws an IllegalStateException if the output is null, and otherwise returns false without checking the value of imageIndex.
public void removeImage(int imageIndex) throws IOException
If canRemoveImage(imageIndex) returns false, an UnsupportedOperationExceptionwill be thrown.
The removal may or may not cause a reduction in the actual file size.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public boolean canWriteEmpty() throws IOException
The default implementation throws an IllegalStateException if the output is null, and otherwise returns false.
public void prepareWriteEmpty(IIOMetadata streamMetadata, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, List thumbnails, ImageWriteParam param) throws IOException
The writing is not complete until a call to endWriteEmpty occurs. Calls to prepareReplacePixels, replacePixels, and endReplacePixels may occur between calls to prepareWriteEmpty and endWriteEmpty. However, calls to prepareWriteEmpty cannot be nested, and calls to prepareWriteEmpty and prepareInsertEmpty may not be interspersed.
If canWriteEmpty returns false, an UnsupportedOperationException will be thrown.
An ImageWriteParam may optionally be supplied to control the writing process. If param is null, a default write param will be used.
If the supplied ImageWriteParam contains optional setting values not supported by this
writer (
e.g.
progressive encoding or any format-specific settings),
writer,
they will be ignored.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public void endWriteEmpty() throws IOException
If canWriteEmpty() returns false, an UnsupportedOperationException will be thrown.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public boolean canInsertEmpty(int imageIndex) throws IOException
A writer that does not support insertion of empty images may return false without performing bounds checking on the index.
The default implementation throws an IllegalStateException if the output is null, and otherwise returns false without checking the value of imageIndex.
public void prepareInsertEmpty(int imageIndex, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, List thumbnails, ImageWriteParam param) throws IOException
The image contents may be supplied later using the replacePixels method. The insertion is not complete until a call to endInsertEmpty occurs. Calls to prepareReplacePixels, replacePixels, and endReplacePixels may occur between calls to prepareInsertEmpty and endInsertEmpty. However, calls to prepareInsertEmpty cannot be nested, and calls to prepareWriteEmpty and prepareInsertEmpty may not be interspersed.
If canInsertEmpty(imageIndex) returns false, an UnsupportedOperationException will be thrown.
An ImageWriteParam may optionally be supplied to control the writing process. If param is null, a default write param will be used.
If the supplied ImageWriteParam contains optional setting values not supported by this
writer (
e.g.
progressive encoding or any format-specific settings),
writer,
they will be ignored.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public void endInsertEmpty() throws IOException
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public boolean canReplacePixels(int imageIndex) throws IOException
A writer that does not support any pixel replacement may return false without performing bounds checking on the index.
The default implementation throws an IllegalStateException if the output is null, and otherwise returns false without checking the value of imageIndex.
public void prepareReplacePixels(int imageIndex, Rectangle region) throws IOException
If canReplacePixels returns false, and UnsupportedOperationException will be thrown.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public void replacePixels(RenderedImage image, ImageWriteParam param) throws IOException
The destination region is specified in the param argument, and will be clipped to the image boundaries and the region supplied to prepareReplacePixels. At least one pixel of the source must not be clipped, or an exception is thrown.
An ImageWriteParam may optionally be supplied to control the writing process. If param is null, a default write param will be used.
If the supplied ImageWriteParam contains optional setting values not supported by this
writer (
e.g.
progressive encoding or any format-specific settings),
writer,
they will be ignored.
This method may only be called after a call to prepareReplacePixels, or else an IllegalStateException will be thrown.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public void replacePixels(Raster raster, ImageWriteParam param) throws IOException
An ImageWriteParam may optionally be supplied to control the writing process. If param is null, a default write param will be used.
The destination region is specified in the param argument, and will be clipped to the image boundaries and the region supplied to prepareReplacePixels. At least one pixel of the source must not be clipped, or an exception is thrown.
If the supplied ImageWriteParam contains optional setting values not supported by this
writer (
e.g.
progressive encoding or any format-specific settings),
writer,
they will be ignored.
This method may only be called after a call to prepareReplacePixels, or else an IllegalStateException will be thrown.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public void endReplacePixels() throws IOException
If canReplacePixels returns false, and UnsupportedOperationException will be thrown.
The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
public void abort()
Writers should call clearAbortRequest at the beginning of each write operation, and poll the value of abortRequested regularly during the write.
protected boolean abortRequested()
protected void clearAbortRequest()
public void addIIOWriteWarningListener(IIOWriteWarningListener listener)
public void removeIIOWriteWarningListener(IIOWriteWarningListener listener)
public void removeAllIIOWriteWarningListeners()
The default implementation sets the warningListeners and warningLocales instance variables to null.
public void addIIOWriteProgressListener(IIOWriteProgressListener listener)
public void removeIIOWriteProgressListener(IIOWriteProgressListener listener)
public void removeAllIIOWriteProgressListeners()
The default implementation sets the progressListeners instance variable to null.
protected void processImageStarted(int imageIndex)
protected void processImageProgress(float percentageDone)
protected void processImageComplete()
protected void processThumbnailStarted(int imageIndex, int thumbnailIndex)
protected void processThumbnailProgress(float percentageDone)
protected void processThumbnailComplete()
protected void processWriteAborted()
protected void processWarningOccurred(int imageIndex, String warning)
protected void processWarningOccurred(int imageIndex, String baseName, String keyword)
public void reset()
The default implementation calls setOutput(null), setLocale(null), removeAllIIOWriteWarningListeners(), removeAllIIOWriteProgressListeners(), and clearAbortRequest.
public void dispose()
It is important for applications to call this method when they know they will no longer be using this ImageWriter. Otherwise, the writer may continue to hold on to resources indefinitely.
The default implementation of this method in the superclass does nothing. Subclass implementations should ensure that all resources, especially native resources, are released.