Java Doc for ImageWriter.java in  » 6.0-JDK-Core » image » javax » imageio » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » image » javax.imageio 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.imageio.ImageWriter

ImageWriter
abstract public class ImageWriter implements ImageTranscoder(Code)
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.


See Also:   ImageReader
See Also:   ImageWriteParam
See Also:   javax.imageio.spi.IIORegistry
See Also:   javax.imageio.spi.ImageWriterSpi
version:
   0.5



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  Localelocale
     The current Locale to be used for localization, or null if none has been set.
protected  ImageWriterSpioriginatingProvider
     The ImageWriterSpi that instantiated this object, or null if its identity is not known or none exists.
protected  Objectoutput
     The ImageOutputStream or other Object set by setOutput and retrieved by getOutput.
protected  List<IIOWriteProgressListener>progressListeners
     A List of currently registered IIOWriteProgressListeners, initialized by default null, which is synonymous with an empty List.
protected  List<IIOWriteWarningListener>warningListeners
     A List of currently registered IIOWriteWarningListeners, initialized by default to null, which is synonymous with an empty List.
protected  List<Locale>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.

Subclasses that make use of extensions should provide a constructor with signature (ImageWriterSpi, Object) in order to retrieve the extension object.


Method Summary
public synchronized  voidabort()
     Requests that any current write operation be aborted.
protected synchronized  booleanabortRequested()
     Returns true if a request to abort the current write operation has been made since the writer was instantiated or clearAbortRequest was called.
public  voidaddIIOWriteProgressListener(IIOWriteProgressListener listener)
     Adds an IIOWriteProgressListener to the list of registered progress listeners.
public  voidaddIIOWriteWarningListener(IIOWriteWarningListener listener)
     Adds an IIOWriteWarningListener to the list of registered warning listeners.
public  booleancanInsertEmpty(int imageIndex)
     Returns true if the writer supports the insertion of a new, empty image at the given index.
public  booleancanInsertImage(int imageIndex)
     Returns true if the writer supports the insertion of a new image at the given index.
public  booleancanRemoveImage(int imageIndex)
     Returns true if the writer supports the removal of an existing image at the given index.
public  booleancanReplaceImageMetadata(int imageIndex)
     Returns true if it is possible to replace the image metadata associated with an existing image with index imageIndex.
public  booleancanReplacePixels(int imageIndex)
     Returns true if the writer allows pixels of the given image to be replaced using the replacePixels methods.

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.
Parameters:
  imageIndex - the index of the image whose pixels are to bereplaced.

public  booleancanReplaceStreamMetadata()
     Returns true if it is possible to replace the stream metadata already present in the output.
public  booleancanWriteEmpty()
     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.
public  booleancanWriteRasters()
     Returns true if the methods that take an IIOImage parameter are capable of dealing with a Raster (as opposed to RenderedImage) source image.
public  booleancanWriteSequence()
     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 synchronized  voidclearAbortRequest()
     Clears any previous abort request.
abstract public  IIOMetadataconvertImageMetadata(IIOMetadata inData, ImageTypeSpecifier imageType, ImageWriteParam param)
    
abstract public  IIOMetadataconvertStreamMetadata(IIOMetadata inData, ImageWriteParam param)
    
public  voiddispose()
     Allows any resources held by this object to be released.
public  voidendInsertEmpty()
     Completes the insertion of a new image that was begun with a prior call to prepareInsertEmpty.
public  voidendReplacePixels()
     Terminates a sequence of calls to replacePixels.
public  voidendWriteEmpty()
     Completes the writing of a new image that was begun with a prior call to prepareWriteEmpty.
public  voidendWriteSequence()
     Completes the writing of a sequence of images begun with prepareWriteSequence.
public  Locale[]getAvailableLocales()
     Returns an array of Locales that may be used to localize warning listeners and compression settings.
abstract public  IIOMetadatagetDefaultImageMetadata(ImageTypeSpecifier imageType, ImageWriteParam param)
     Returns an IIOMetadata object containing default values for encoding an image of the given type.
abstract public  IIOMetadatagetDefaultStreamMetadata(ImageWriteParam param)
     Returns an IIOMetadata object containing default values for encoding a stream of images.
public  ImageWriteParamgetDefaultWriteParam()
     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.
public  LocalegetLocale()
     Returns the currently set Locale, or null if none has been set.
public  intgetNumThumbnailsSupported(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.
public  ImageWriterSpigetOriginatingProvider()
     Returns the ImageWriterSpi object that created this ImageWriter, or null if this object was not created through the IIORegistry.
public  ObjectgetOutput()
     Returns the ImageOutputStream or other Object set by the most recent call to the setOutput method.
public  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.
public  voidprepareInsertEmpty(int imageIndex, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails, ImageWriteParam param)
     Begins the insertion of a new image with undefined pixel values into an existing image stream.
public  voidprepareReplacePixels(int imageIndex, Rectangle region)
     Prepares the writer to handle a series of calls to the replacePixels methods.
public  voidprepareWriteEmpty(IIOMetadata streamMetadata, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, List<? extends BufferedImage> 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.
public  voidprepareWriteSequence(IIOMetadata streamMetadata)
     Prepares a stream to accept a series of subsequent writeToSequence calls, using the provided stream metadata object.
protected  voidprocessImageComplete()
     Broadcasts the completion of an image write to all registered IIOWriteProgressListeners by calling their imageComplete method.
protected  voidprocessImageProgress(float percentageDone)
     Broadcasts the current percentage of image completion to all registered IIOWriteProgressListeners by calling their imageProgress method.
protected  voidprocessImageStarted(int imageIndex)
     Broadcasts the start of an image write to all registered IIOWriteProgressListeners by calling their imageStarted method.
protected  voidprocessThumbnailComplete()
     Broadcasts the completion of a thumbnail write to all registered IIOWriteProgressListeners by calling their thumbnailComplete method.
protected  voidprocessThumbnailProgress(float percentageDone)
     Broadcasts the current percentage of thumbnail completion to all registered IIOWriteProgressListeners by calling their thumbnailProgress method.
protected  voidprocessThumbnailStarted(int imageIndex, int thumbnailIndex)
     Broadcasts the start of a thumbnail write to all registered IIOWriteProgressListeners by calling their thumbnailStarted method.
protected  voidprocessWarningOccurred(int imageIndex, String warning)
     Broadcasts a warning message to all registered IIOWriteWarningListeners by calling their warningOccurred method.
protected  voidprocessWarningOccurred(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  voidprocessWriteAborted()
     Broadcasts that the write has been aborted to all registered IIOWriteProgressListeners by calling their writeAborted method.
public  voidremoveAllIIOWriteProgressListeners()
     Removes all currently registered IIOWriteProgressListener objects.
public  voidremoveAllIIOWriteWarningListeners()
     Removes all currently registered IIOWriteWarningListener objects.
public  voidremoveIIOWriteProgressListener(IIOWriteProgressListener listener)
     Removes an IIOWriteProgressListener from the list of registered progress listeners.
public  voidremoveIIOWriteWarningListener(IIOWriteWarningListener listener)
     Removes an IIOWriteWarningListener from the list of registered warning listeners.
public  voidremoveImage(int imageIndex)
     Removes an image from the stream.
public  voidreplaceImageMetadata(int imageIndex, IIOMetadata imageMetadata)
     Replaces the image metadata associated with an existing image.
public  voidreplacePixels(RenderedImage image, ImageWriteParam param)
     Replaces a portion of an image already present in the output with a portion of the given image.
public  voidreplacePixels(Raster raster, ImageWriteParam param)
     Replaces a portion of an image already present in the output with a portion of the given Raster.
public  voidreplaceStreamMetadata(IIOMetadata streamMetadata)
     Replaces the stream metadata in the output with new information.
public  voidreset()
     Restores the ImageWriter to its initial state.
public  voidsetLocale(Locale locale)
     Sets the current Locale of this ImageWriter to the given value.
public  voidsetOutput(Object output)
     Sets the destination to the given ImageOutputStream or other Object. The destination is assumed to be ready to accept data, and will not be closed at the end of each write.
abstract public  voidwrite(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.
public  voidwrite(IIOImage image)
     Appends a complete image stream containing a single image with default metadata and thumbnails to the output.
public  voidwrite(RenderedImage image)
     Appends a complete image stream consisting of a single image with default metadata and thumbnails to the output.
public  voidwriteInsert(int imageIndex, IIOImage image, ImageWriteParam param)
     Inserts a new image into an existing image stream.
public  voidwriteToSequence(IIOImage image, ImageWriteParam param)
     Appends a single image and possibly associated metadata and thumbnails, to the output.

Field Detail
availableLocales
protected Locale[] availableLocales(Code)
An array of Locales that may be used to localize warning messages and compression setting values, or null if localization is not supported. By default it is initialized to null.



locale
protected Locale locale(Code)
The current Locale to be used for localization, or null if none has been set. By default it is initialized to null.



originatingProvider
protected ImageWriterSpi originatingProvider(Code)
The ImageWriterSpi that instantiated this object, or null if its identity is not known or none exists. By default it is initialized to null.



output
protected Object output(Code)
The ImageOutputStream or other Object set by setOutput and retrieved by getOutput. By default it is initialized to null.



progressListeners
protected List<IIOWriteProgressListener> progressListeners(Code)
A List of currently registered IIOWriteProgressListeners, initialized by default null, which is synonymous with an empty List.



warningListeners
protected List<IIOWriteWarningListener> warningListeners(Code)
A List of currently registered IIOWriteWarningListeners, initialized by default to null, which is synonymous with an empty List.



warningLocales
protected List<Locale> warningLocales(Code)
A List of Locales, one for each element of warningListeners, initialized by default null, which is synonymous with an empty List.




Constructor Detail
ImageWriter
protected ImageWriter(ImageWriterSpi originatingProvider)(Code)
Constructs an ImageWriter and sets its originatingProvider instance variable to the supplied value.

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.
Parameters:
  originatingProvider - the ImageWriterSpi thatis constructing this object, or null.





Method Detail
abort
public synchronized void abort()(Code)
Requests that any current write operation be aborted. The contents of the output following the abort will be undefined.

Writers should call clearAbortRequest at the beginning of each write operation, and poll the value of abortRequested regularly during the write.




abortRequested
protected synchronized boolean abortRequested()(Code)
Returns true if a request to abort the current write operation has been made since the writer was instantiated or clearAbortRequest was called. true if the current write operation shouldbe aborted.
See Also:   ImageWriter.abort
See Also:   ImageWriter.clearAbortRequest



addIIOWriteProgressListener
public void addIIOWriteProgressListener(IIOWriteProgressListener listener)(Code)
Adds an IIOWriteProgressListener to the list of registered progress listeners. If listener is null, no exception will be thrown and no action will be taken.
Parameters:
  listener - an IIOWriteProgressListener to beregistered.
See Also:   ImageWriter.removeIIOWriteProgressListener



addIIOWriteWarningListener
public void addIIOWriteWarningListener(IIOWriteWarningListener listener)(Code)
Adds an IIOWriteWarningListener to the list of registered warning listeners. If listener is null, no exception will be thrown and no action will be taken. Messages sent to the given listener will be localized, if possible, to match the current Locale. If no Locale has been set, warning messages may be localized as the writer sees fit.
Parameters:
  listener - an IIOWriteWarningListener to beregistered.
See Also:   ImageWriter.removeIIOWriteWarningListener



canInsertEmpty
public boolean canInsertEmpty(int imageIndex) throws IOException(Code)
Returns true if the writer supports the insertion of a new, empty image at the given index. The pixel values of the image are undefined, and may be specified in pieces using the replacePixels methods. Existing images with indices greater than or equal to the insertion index will have their indices increased by 1. A value for imageIndex of -1 may be used to signify an index one larger than the current largest index.

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.
Parameters:
  imageIndex - the index at which the image is to beinserted. true if an empty image may be inserted atthe given index.
exception:
  IllegalStateException - if the output has not beenset.
exception:
  IndexOutOfBoundsException - if the writer supportsempty image insertion in general, but imageIndexis less than -1 or greater than the largest available index.
exception:
  IOException - if an I/O error occurs during thequery.




canInsertImage
public boolean canInsertImage(int imageIndex) throws IOException(Code)
Returns true if the writer supports the insertion of a new image at the given index. Existing images with indices greater than or equal to the insertion index will have their indices increased by 1. A value for imageIndex of -1 may be used to signify an index one larger than the current largest index.

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.
Parameters:
  imageIndex - the index at which the image is to beinserted. true if an image may be inserted at thegiven index.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  IndexOutOfBoundsException - if the writer supportsimage insertion in general, but imageIndex is lessthan -1 or greater than the largest available index.
exception:
  IOException - if an I/O error occurs during the query.




canRemoveImage
public boolean canRemoveImage(int imageIndex) throws IOException(Code)
Returns true if the writer supports the removal of an existing image at the given index. Existing images with indices greater than the insertion index will have their indices decreased by 1.

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.
Parameters:
  imageIndex - the index of the image to be removed. true if it is possible to remove the givenimage.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  IndexOutOfBoundsException - if the writer supportsimage removal in general, but imageIndex is lessthan 0 or greater than the largest available index.
exception:
  IOException - if an I/O error occurs during thequery.




canReplaceImageMetadata
public boolean canReplaceImageMetadata(int imageIndex) throws IOException(Code)
Returns true if it is possible to replace the image metadata associated with an existing image with index imageIndex. If this method returns false, a call to replaceImageMetadata(imageIndex) will throw an UnsupportedOperationException.

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.
Parameters:
  imageIndex - the index of the image whose metadata is tobe replaced. true if the image metadata of the givenimage can be replaced.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  IndexOutOfBoundsException - if the writer supportsimage metadata replacement in general, butimageIndex is less than 0 or greater than thelargest available index.
exception:
  IOException - if an I/O error occurs during the query.




canReplacePixels
public boolean canReplacePixels(int imageIndex) throws IOException(Code)
Returns true if the writer allows pixels of the given image to be replaced using the replacePixels methods.

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.
Parameters:
  imageIndex - the index of the image whose pixels are to bereplaced. true if the pixels of the givenimage can be replaced.
exception:
  IllegalStateException - if the output has not beenset.
exception:
  IndexOutOfBoundsException - if the writer supportspixel replacement in general, but imageIndex isless than 0 or greater than the largest available index.
exception:
  IOException - if an I/O error occurs during the query.




canReplaceStreamMetadata
public boolean canReplaceStreamMetadata() throws IOException(Code)
Returns true if it is possible to replace the stream metadata already present in the output.

The default implementation throws an IllegalStateException if the output is null, and otherwise returns false. true if replacement of stream metadata isallowed.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  IOException - if an I/O error occurs during the query.




canWriteEmpty
public boolean canWriteEmpty() throws IOException(Code)
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. The pixel values may be defined by future calls to the replacePixels methods. If the output is an ImageOutputStream, its existing contents prior to the current seek position are not affected, and need not be readable or writable.

The default implementation throws an IllegalStateException if the output is null, and otherwise returns false. true if the writing of complete imagestream with contents to be defined later is supported.
exception:
  IllegalStateException - if the output has not beenset.
exception:
  IOException - if an I/O error occurs during thequery.




canWriteRasters
public boolean canWriteRasters()(Code)
Returns true if the methods that take an IIOImage parameter are capable of dealing with a Raster (as opposed to RenderedImage) source image. If this method returns false, then those methods will throw an UnsupportedOperationException if supplied with an IIOImage containing a Raster.

The default implementation returns false. true if Raster sources aresupported.




canWriteSequence
public boolean canWriteSequence()(Code)
Returns true if the writer is able to append an image to an image stream that already contains header information and possibly prior images.

If canWriteSequence returns false, writeToSequence and endWriteSequence will throw an UnsupportedOperationException.

The default implementation returns false. true if images may be appended sequentially.




clearAbortRequest
protected synchronized void clearAbortRequest()(Code)
Clears any previous abort request. After this method has been called, abortRequested will return false.
See Also:   ImageWriter.abort
See Also:   ImageWriter.abortRequested



convertImageMetadata
abstract public IIOMetadata convertImageMetadata(IIOMetadata inData, ImageTypeSpecifier imageType, ImageWriteParam param)(Code)



convertStreamMetadata
abstract public IIOMetadata convertStreamMetadata(IIOMetadata inData, ImageWriteParam param)(Code)



dispose
public void dispose()(Code)
Allows any resources held by this object to be released. The result of calling any other method (other than finalize) subsequent to a call to this method is undefined.

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.




endInsertEmpty
public void endInsertEmpty() throws IOException(Code)
Completes the insertion of a new image that was begun with a prior call to prepareInsertEmpty.

The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - ifcanInsertEmpty(imageIndex) returnsfalse.
exception:
  IllegalStateException - if a previous call toprepareInsertEmpty without a corresponding call toendInsertEmpty has not been made.
exception:
  IllegalStateException - if a previous call toprepareWriteEmpty without a corresponding call toendWriteEmpty has been made.
exception:
  IllegalStateException - if a call toprepareReplacePixels has been made without amatching call to endReplacePixels.
exception:
  IOException - if an I/O error occurs during writing.




endReplacePixels
public void endReplacePixels() throws IOException(Code)
Terminates a sequence of calls to replacePixels.

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.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - ifcanReplacePixels(imageIndex) returnsfalse.
exception:
  IllegalStateException - if there is no previous callto prepareReplacePixels without a matching call toendReplacePixels.
exception:
  IOException - if an I/O error occurs during writing.




endWriteEmpty
public void endWriteEmpty() throws IOException(Code)
Completes the writing of a new image that was begun with a prior call to prepareWriteEmpty.

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.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - ifcanWriteEmpty(imageIndex) returnsfalse.
exception:
  IllegalStateException - if a previous call toprepareWriteEmpty without a corresponding call toendWriteEmpty has not been made.
exception:
  IllegalStateException - if a previous call toprepareInsertEmpty without a corresponding call toendInsertEmpty has been made.
exception:
  IllegalStateException - if a call toprepareReiplacePixels has been made without amatching call to endReplacePixels.
exception:
  IOException - if an I/O error occurs during writing.




endWriteSequence
public void endWriteSequence() throws IOException(Code)
Completes the writing of a sequence of images begun with prepareWriteSequence. Any stream metadata that should come at the end of the sequence of images is written out, and any header information at the beginning of the sequence is patched up if necessary. If the output is an ImageOutputStream, data through the stream metadata at the end of the sequence are flushed and need not be readable or writable.

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.
exception:
  IllegalStateException - if the output has notbeen set, or prepareWriteSequence has not been called.
exception:
  UnsupportedOperationException - ifcanWriteSequence returns false.
exception:
  IOException - if an error occurs during writing.




getAvailableLocales
public Locale[] getAvailableLocales()(Code)
Returns an array of Locales that may be used to localize warning listeners and compression settings. A return value of null indicates that localization is not supported.

The default implementation returns a clone of the availableLocales instance variable if it is non-null, or else returns null. an array of Locales that may be used asarguments to setLocale, or null.




getDefaultImageMetadata
abstract public IIOMetadata getDefaultImageMetadata(ImageTypeSpecifier imageType, ImageWriteParam param)(Code)
Returns an IIOMetadata object containing default values for encoding an image of the given type. The contents of the object may be manipulated using either the XML tree structure returned by the IIOMetadata.getAsTree method, an IIOMetadataController object, or via plug-in specific interfaces, and the resulting data supplied to one of the write methods that take a stream metadata parameter.

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), they will be ignored.
Parameters:
  imageType - an ImageTypeSpecifier indicating theformat of the image to be written later.
Parameters:
  param - an ImageWriteParam that will be used toencode the image, or null. an IIOMetadata object.




getDefaultStreamMetadata
abstract public IIOMetadata getDefaultStreamMetadata(ImageWriteParam param)(Code)
Returns an IIOMetadata object containing default values for encoding a stream of images. The contents of the object may be manipulated using either the XML tree structure returned by the IIOMetadata.getAsTree method, an IIOMetadataController object, or via plug-in specific interfaces, and the resulting data supplied to one of the write methods that take a stream metadata parameter.

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), they will be ignored.

Writers that do not make use of stream metadata (e.g., writers for single-image formats) should return null.
Parameters:
  param - an ImageWriteParam that will be used toencode the image, or null. an IIOMetadata object.




getDefaultWriteParam
public ImageWriteParam getDefaultWriteParam()(Code)
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. This is useful as a starting point for tweaking just a few parameters and otherwise leaving the default settings alone.

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. a new ImageWriteParam object containingdefault values.




getLocale
public Locale getLocale()(Code)
Returns the currently set Locale, or null if none has been set.

The default implementation returns the value of the locale instance variable. the current Locale, or null.
See Also:   ImageWriter.setLocale




getNumThumbnailsSupported
public int getNumThumbnailsSupported(ImageTypeSpecifier imageType, ImageWriteParam param, IIOMetadata streamMetadata, IIOMetadata imageMetadata)(Code)
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. A return value of -1 indicates that insufficient information is available.

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), they will be ignored.

The default implementation returns 0.
Parameters:
  imageType - an ImageTypeSpecifier indicatingthe type of image to be written, or null.
Parameters:
  param - the ImageWriteParam that will be used forwriting, or null.
Parameters:
  streamMetadata - an IIOMetadata object that willbe used for writing, or null.
Parameters:
  imageMetadata - an IIOMetadata object that willbe used for writing, or null. the number of thumbnails that may be written given thesupplied parameters, or -1 if insufficientinformation is available.




getOriginatingProvider
public ImageWriterSpi getOriginatingProvider()(Code)
Returns the ImageWriterSpi object that created this ImageWriter, or null if this object was not created through the IIORegistry.

The default implementation returns the value of the originatingProvider instance variable. an ImageWriterSpi, or null.
See Also:   ImageWriterSpi




getOutput
public Object getOutput()(Code)
Returns the ImageOutputStream or other Object set by the most recent call to the setOutput method. If no destination has been set, null is returned.

The default implementation returns the value of the output instance variable. the Object that was specified usingsetOutput, or null.
See Also:   ImageWriter.setOutput




getPreferredThumbnailSizes
public Dimension[] getPreferredThumbnailSizes(ImageTypeSpecifier imageType, ImageWriteParam param, IIOMetadata streamMetadata, IIOMetadata imageMetadata)(Code)
Returns an array of Dimensions indicating the legal size ranges for thumbnail images as they will be encoded in the output file or stream. This information is merely advisory; the writer will resize any supplied thumbnails as necessary.

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), they will be ignored.

The default implementation returns null.
Parameters:
  imageType - an ImageTypeSpecifier indicating thetype of image to be written, or null.
Parameters:
  param - the ImageWriteParam that will be used forwriting, or null.
Parameters:
  streamMetadata - an IIOMetadata object that willbe used for writing, or null.
Parameters:
  imageMetadata - an IIOMetadata object that willbe used for writing, or null. an array of Dimensions with an even lengthof at least two, or null.




prepareInsertEmpty
public void prepareInsertEmpty(int imageIndex, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails, ImageWriteParam param) throws IOException(Code)
Begins the insertion of a new image with undefined pixel values into an existing image stream. Existing images with an index greater than imageIndex are preserved, and their indices are each increased by 1. A value for imageIndex of -1 may be used to signify an index one larger than the previous largest index; that is, it will cause the image to be logically appended to the end of the sequence. If the output is an ImageOutputStream, the entirety of the stream must be both readable and writeable.

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), they will be ignored.

The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
Parameters:
  imageIndex - the index at which to write the image.
Parameters:
  imageType - an ImageTypeSpecifier describingthe layout of the image.
Parameters:
  width - the width of the image.
Parameters:
  height - the height of the image.
Parameters:
  imageMetadata - an IIOMetadata objectrepresenting image metadata, or null.
Parameters:
  thumbnails - a List ofBufferedImage thumbnails for this image, ornull.
Parameters:
  param - an ImageWriteParam, ornull to use a defaultImageWriteParam.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - ifcanInsertEmpty(imageIndex) returnsfalse.
exception:
  IndexOutOfBoundsException - if imageIndexis less than -1 or greater than the largest available index.
exception:
  IllegalStateException - if a previous call toprepareInsertEmpty has been made without acorresponding call to endInsertEmpty.
exception:
  IllegalStateException - if a previous call toprepareWriteEmpty has been made without acorresponding call to endWriteEmpty.
exception:
  IllegalArgumentException - if imageTypeis null or thumbnails containsnull references or objects other thanBufferedImages.
exception:
  IllegalArgumentException - if width or height are lessthan 1.
exception:
  IOException - if an I/O error occurs during writing.




prepareReplacePixels
public void prepareReplacePixels(int imageIndex, Rectangle region) throws IOException(Code)
Prepares the writer to handle a series of calls to the replacePixels methods. The affected pixel area will be clipped against the supplied

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.
Parameters:
  imageIndex - the index of the image whose pixels are to bereplaced.
Parameters:
  region - a Rectangle that will be used to clipfuture pixel regions.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - ifcanReplacePixels(imageIndex) returnsfalse.
exception:
  IndexOutOfBoundsException - if imageIndexis less than 0 or greater than the largest available index.
exception:
  IllegalStateException - if there is a previous call toprepareReplacePixels without a matching call toendReplacePixels (i.e., nesting is notallowed).
exception:
  IllegalArgumentException - if region isnull or has a width or height less than 1.
exception:
  IOException - if an I/O error occurs during thepreparation.




prepareWriteEmpty
public void prepareWriteEmpty(IIOMetadata streamMetadata, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails, ImageWriteParam param) throws IOException(Code)
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. The pixel values will be defined by future calls to the replacePixels methods. If the output is an ImageOutputStream, its existing contents prior to the current seek position are not affected, and need not be readable or writable.

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), they will be ignored.

The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
Parameters:
  streamMetadata - an IIOMetadata object representingstream metadata, or null to use default values.
Parameters:
  imageType - an ImageTypeSpecifier describingthe layout of the image.
Parameters:
  width - the width of the image.
Parameters:
  height - the height of the image.
Parameters:
  imageMetadata - an IIOMetadata objectrepresenting image metadata, or null.
Parameters:
  thumbnails - a List ofBufferedImage thumbnails for this image, ornull.
Parameters:
  param - an ImageWriteParam, ornull to use a defaultImageWriteParam.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - ifcanWriteEmpty returns false.
exception:
  IllegalStateException - if a previous call toprepareWriteEmpty has been made without acorresponding call to endWriteEmpty.
exception:
  IllegalStateException - if a previous call toprepareInsertEmpty has been made without acorresponding call to endInsertEmpty.
exception:
  IllegalArgumentException - if imageTypeis null or thumbnails containsnull references or objects other thanBufferedImages.
exception:
  IllegalArgumentException - if width or height are lessthan 1.
exception:
  IOException - if an I/O error occurs during writing.




prepareWriteSequence
public void prepareWriteSequence(IIOMetadata streamMetadata) throws IOException(Code)
Prepares a stream to accept a series of subsequent writeToSequence calls, using the provided stream metadata object. The metadata will be written to the stream if it should precede the image data. If the argument is null, default stream metadata is used.

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.
Parameters:
  streamMetadata - A stream metadata object, or null.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - ifcanWriteSequence returns false.
exception:
  IOException - if an error occurs writing the streammetadata.




processImageComplete
protected void processImageComplete()(Code)
Broadcasts the completion of an image write to all registered IIOWriteProgressListeners by calling their imageComplete method. Subclasses may use this method as a convenience.



processImageProgress
protected void processImageProgress(float percentageDone)(Code)
Broadcasts the current percentage of image completion to all registered IIOWriteProgressListeners by calling their imageProgress method. Subclasses may use this method as a convenience.
Parameters:
  percentageDone - the current percentage of completion,as a float.



processImageStarted
protected void processImageStarted(int imageIndex)(Code)
Broadcasts the start of an image write to all registered IIOWriteProgressListeners by calling their imageStarted method. Subclasses may use this method as a convenience.
Parameters:
  imageIndex - the index of the image about to be written.



processThumbnailComplete
protected void processThumbnailComplete()(Code)
Broadcasts the completion of a thumbnail write to all registered IIOWriteProgressListeners by calling their thumbnailComplete method. Subclasses may use this method as a convenience.



processThumbnailProgress
protected void processThumbnailProgress(float percentageDone)(Code)
Broadcasts the current percentage of thumbnail completion to all registered IIOWriteProgressListeners by calling their thumbnailProgress method. Subclasses may use this method as a convenience.
Parameters:
  percentageDone - the current percentage of completion,as a float.



processThumbnailStarted
protected void processThumbnailStarted(int imageIndex, int thumbnailIndex)(Code)
Broadcasts the start of a thumbnail write to all registered IIOWriteProgressListeners by calling their thumbnailStarted method. Subclasses may use this method as a convenience.
Parameters:
  imageIndex - the index of the image associated with thethumbnail.
Parameters:
  thumbnailIndex - the index of the thumbnail.



processWarningOccurred
protected void processWarningOccurred(int imageIndex, String warning)(Code)
Broadcasts a warning message to all registered IIOWriteWarningListeners by calling their warningOccurred method. Subclasses may use this method as a convenience.
Parameters:
  imageIndex - the index of the image on which the warningoccurred.
Parameters:
  warning - the warning message.
exception:
  IllegalArgumentException - if warningis null.



processWarningOccurred
protected void processWarningOccurred(int imageIndex, String baseName, String keyword)(Code)
Broadcasts a localized warning message to all registered IIOWriteWarningListeners by calling their warningOccurred method with a string taken from a ResourceBundle. Subclasses may use this method as a convenience.
Parameters:
  imageIndex - the index of the image on which the warningoccurred.
Parameters:
  baseName - the base name of a set ofResourceBundles containing localized warningmessages.
Parameters:
  keyword - the keyword used to index the warning messagewithin the set of ResourceBundles.
exception:
  IllegalArgumentException - if baseNameis null.
exception:
  IllegalArgumentException - if keywordis null.
exception:
  IllegalArgumentException - if no appropriateResourceBundle may be located.
exception:
  IllegalArgumentException - if the named resource isnot found in the located ResourceBundle.
exception:
  IllegalArgumentException - if the object retrievedfrom the ResourceBundle is not aString.



processWriteAborted
protected void processWriteAborted()(Code)
Broadcasts that the write has been aborted to all registered IIOWriteProgressListeners by calling their writeAborted method. Subclasses may use this method as a convenience.



removeAllIIOWriteProgressListeners
public void removeAllIIOWriteProgressListeners()(Code)
Removes all currently registered IIOWriteProgressListener objects.

The default implementation sets the progressListeners instance variable to null.




removeAllIIOWriteWarningListeners
public void removeAllIIOWriteWarningListeners()(Code)
Removes all currently registered IIOWriteWarningListener objects.

The default implementation sets the warningListeners and warningLocales instance variables to null.




removeIIOWriteProgressListener
public void removeIIOWriteProgressListener(IIOWriteProgressListener listener)(Code)
Removes an IIOWriteProgressListener from the list of registered progress listeners. If the listener was not previously registered, or if listener is null, no exception will be thrown and no action will be taken.
Parameters:
  listener - an IIOWriteProgressListener to bederegistered.
See Also:   ImageWriter.addIIOWriteProgressListener



removeIIOWriteWarningListener
public void removeIIOWriteWarningListener(IIOWriteWarningListener listener)(Code)
Removes an IIOWriteWarningListener from the list of registered warning listeners. If the listener was not previously registered, or if listener is null, no exception will be thrown and no action will be taken.
Parameters:
  listener - an IIOWriteWarningListener to bederegistered.
See Also:   ImageWriter.addIIOWriteWarningListener



removeImage
public void removeImage(int imageIndex) throws IOException(Code)
Removes an image from the stream.

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.
Parameters:
  imageIndex - the index of the image to be removed.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - ifcanRemoveImage(imageIndex) returns false.
exception:
  IndexOutOfBoundsException - if imageIndexis less than 0 or greater than the largest available index.
exception:
  IOException - if an I/O error occurs during theremoval.




replaceImageMetadata
public void replaceImageMetadata(int imageIndex, IIOMetadata imageMetadata) throws IOException(Code)
Replaces the image metadata associated with an existing image.

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.
Parameters:
  imageIndex - the index of the image whose metadata is tobe replaced.
Parameters:
  imageMetadata - an IIOMetadata objectrepresenting image metadata, or null.
exception:
  IllegalStateException - if the output has not beenset.
exception:
  UnsupportedOperationException - ifcanReplaceImageMetadata returnsfalse.
exception:
  IndexOutOfBoundsException - if imageIndexis less than 0 or greater than the largest available index.
exception:
  IOException - if an error occurs during writing.




replacePixels
public void replacePixels(RenderedImage image, ImageWriteParam param) throws IOException(Code)
Replaces a portion of an image already present in the output with a portion of the given image. The image data must match, or be convertible to, the image layout of the existing image.

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), 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.
Parameters:
  image - a RenderedImage containing sourcepixels.
Parameters:
  param - an ImageWriteParam, ornull to use a defaultImageWriteParam.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - ifcanReplacePixels(imageIndex) returnsfalse.
exception:
  IllegalStateException - if there is no previous call toprepareReplacePixels without a matching call toendReplacePixels.
exception:
  IllegalArgumentException - if any of the following are true:

  • image is null.
  • param is null.
  • the intersected region does not contain at least one pixel.
  • the layout of image does not match, or thiswriter cannot convert it to, the existing image layout.

exception:
  IOException - if an I/O error occurs during writing.



replacePixels
public void replacePixels(Raster raster, ImageWriteParam param) throws IOException(Code)
Replaces a portion of an image already present in the output with a portion of the given Raster. The image data must match, or be convertible to, the image layout of the existing image.

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), 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.
Parameters:
  raster - a Raster containing sourcepixels.
Parameters:
  param - an ImageWriteParam, ornull to use a defaultImageWriteParam.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - ifcanReplacePixels(imageIndex) returnsfalse.
exception:
  IllegalStateException - if there is no previous call toprepareReplacePixels without a matching call toendReplacePixels.
exception:
  UnsupportedOperationException - ifcanWriteRasters returns false.
exception:
  IllegalArgumentException - if any of the following are true:

  • raster is null.
  • param is null.
  • the intersected region does not contain at least one pixel.
  • the layout of raster does not match, or thiswriter cannot convert it to, the existing image layout.

exception:
  IOException - if an I/O error occurs during writing.



replaceStreamMetadata
public void replaceStreamMetadata(IIOMetadata streamMetadata) throws IOException(Code)
Replaces the stream metadata in the output with new information. If the output is an ImageOutputStream, the prior contents of the stream are examined and possibly edited to make room for the new data. All of the prior contents of the output must be available for reading and writing.

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.
Parameters:
  streamMetadata - an IIOMetadata object representingstream metadata, or null to use default values.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - if thecanReplaceStreamMetadata returnsfalse. modes do not include
exception:
  IOException - if an error occurs during writing.




reset
public void reset()(Code)
Restores the ImageWriter to its initial state.

The default implementation calls setOutput(null), setLocale(null), removeAllIIOWriteWarningListeners(), removeAllIIOWriteProgressListeners(), and clearAbortRequest.




setLocale
public void setLocale(Locale locale)(Code)
Sets the current Locale of this ImageWriter to the given value. A value of null removes any previous setting, and indicates that the writer should localize as it sees fit.

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.
Parameters:
  locale - the desired Locale, ornull.
exception:
  IllegalArgumentException - if locale isnon-null but is not one of the values returned bygetAvailableLocales.
See Also:   ImageWriter.getLocale




setOutput
public void setOutput(Object output)(Code)
Sets the destination to the given ImageOutputStream or other Object. The destination is assumed to be ready to accept data, and will not be closed at the end of each write. This allows distributed imaging applications to transmit a series of images over a single network connection. If output is null, any currently set output will be removed.

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.
Parameters:
  output - the ImageOutputStream or otherObject to use for future writing.
exception:
  IllegalArgumentException - if output isnot an instance of one of the classes returned by theoriginating service provider's getOutputTypesmethod.
See Also:   ImageWriter.getOutput




write
abstract public void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) throws IOException(Code)
Appends a complete image stream containing a single image and associated stream and image metadata and thumbnails to the output. Any necessary header information is included. If the output is an ImageOutputStream, its existing contents prior to the current seek position are not affected, and need not be readable or writable.

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), they will be ignored.
Parameters:
  streamMetadata - an IIOMetadata object representingstream metadata, or null to use default values.
Parameters:
  image - an IIOImage object containing animage, thumbnails, and metadata to be written.
Parameters:
  param - an ImageWriteParam, ornull to use a defaultImageWriteParam.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - if imagecontains a Raster and canWriteRastersreturns false.
exception:
  IllegalArgumentException - if image isnull.
exception:
  IOException - if an error occurs during writing.




write
public void write(IIOImage image) throws IOException(Code)
Appends a complete image stream containing a single image with default metadata and thumbnails to the output. This method is a shorthand for write(null, image, null).
Parameters:
  image - an IIOImage object containing animage, thumbnails, and metadata to be written.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  IllegalArgumentException - if image isnull.
exception:
  UnsupportedOperationException - if imagecontains a Raster and canWriteRastersreturns false.
exception:
  IOException - if an error occurs during writing.



write
public void write(RenderedImage image) throws IOException(Code)
Appends a complete image stream consisting of a single image with default metadata and thumbnails to the output. This method is a shorthand for write(null, new IIOImage(image, null, null), null).
Parameters:
  image - a RenderedImage to be written.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  IllegalArgumentException - if image isnull.
exception:
  IOException - if an error occurs during writing.



writeInsert
public void writeInsert(int imageIndex, IIOImage image, ImageWriteParam param) throws IOException(Code)
Inserts a new image into an existing image stream. Existing images with an index greater than imageIndex are preserved, and their indices are each increased by 1. A value for imageIndex of -1 may be used to signify an index one larger than the previous largest index; that is, it will cause the image to be logically appended to the end of the sequence. If the output is an ImageOutputStream, the entirety of the stream must be both readable and writeable.

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), they will be ignored.

The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
Parameters:
  imageIndex - the index at which to write the image.
Parameters:
  image - an IIOImage object containing animage, thumbnails, and metadata to be written.
Parameters:
  param - an ImageWriteParam, ornull to use a defaultImageWriteParam.
exception:
  IllegalStateException - if the output has notbeen set.
exception:
  UnsupportedOperationException - ifcanInsertImage(imageIndex) returns false.
exception:
  IllegalArgumentException - if image isnull.
exception:
  IndexOutOfBoundsException - if imageIndexis less than -1 or greater than the largest available index.
exception:
  UnsupportedOperationException - if imagecontains a Raster and canWriteRastersreturns false.
exception:
  IOException - if an error occurs during writing.




writeToSequence
public void writeToSequence(IIOImage image, ImageWriteParam param) throws IOException(Code)
Appends a single image and possibly associated metadata and thumbnails, to the output. If the output is an ImageOutputStream, the existing contents of the output prior to the current seek position may be flushed, and need not be readable or writable, unless the plug-in needs to be able to patch up the header information when endWriteSequence is called (e.g. TIFF).

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), they will be ignored.

The default implementation throws an IllegalStateException if the output is null, and otherwise throws an UnsupportedOperationException.
Parameters:
  image - an IIOImage object containing animage, thumbnails, and metadata to be written.
Parameters:
  param - an ImageWriteParam, ornull to use a defaultImageWriteParam.
exception:
  IllegalStateException - if the output has notbeen set, or prepareWriteSequence has not been called.
exception:
  UnsupportedOperationException - ifcanWriteSequence returns false.
exception:
  IllegalArgumentException - if image isnull.
exception:
  UnsupportedOperationException - if imagecontains a Raster and canWriteRastersreturns false.
exception:
  IOException - if an error occurs during writing.




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.