IIOMetadata streamMetadata, IIOMetadata imageMetadata) { return null; } /** * Returns <code>true</code> if the methods that take an * <code>IIOImage</code> parameter are capable of dealing with a * <code>Raster</code> (as opposed to <code>RenderedImage</code>) * source image. If this method returns <code>false</code>, then * those methods will throw an * <code>UnsupportedOperationException</code> if supplied with an * <code>IIOImage</code> containing a <code>Raster</code>. * * <p> The default implementation returns <code>false</code>. * * @return <code>true</code> if <code>Raster</code> sources are * supported. */ public boolean canWriteRasters() { return false; } /** * 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 <code>ImageOutputStream</code>, its existing * contents prior to the current seek position are not affected, * and need not be readable or writable. * * <p> The output must have been set beforehand using the * <code>setOutput</code> method. * * <p> Stream metadata may optionally be supplied; if it is * <code>null</code>, default stream metadata will be used. * * <p> If <code>canWriteRasters</code> returns <code>true</code>, * the <code>IIOImage</code> may contain a <code>Raster</code> * source. Otherwise, it must contain a * <code>RenderedImage</code> source. * * <p> 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. * * <p> An <code>ImageWriteParam</code> may * optionally be supplied to control the writing process. If * <code>param</code> is <code>null</code>, a default write param * will be used. * * <p> If the supplied <code>ImageWriteParam</code> contains * optional setting values not supported by this writer (<i>e.g.</i> * progressive encoding or any format-specific settings), they * will be ignored. * * @param streamMetadata an <code>IIOMetadata</code> object representing * stream metadata, or <code>null</code> to use default values. * @param image an <code>IIOImage</code> object containing an * image, thumbnails, and metadata to be written. * @param param an <code>ImageWriteParam</code>, or * <code>null</code> to use a default * <code>ImageWriteParam</code>. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if <code>image</code> * contains a <code>Raster</code> and <code>canWriteRasters</code> * returns <code>false</code>. * @exception IllegalArgumentException if <code>image</code> is * <code>null</code>. * @exception IOException if an error occurs during writing. */ public abstract void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) throws IOException; /** * Appends a complete image stream containing a single image with * default metadata and thumbnails to the output. This method is * a shorthand for <code>write(null, image, null)</code>. * * @param image an <code>IIOImage</code> object containing an * image, thumbnails, and metadata to be written. * * @exception IllegalStateException if the output has not * been set. * @exception IllegalArgumentException if <code>image</code> is * <code>null</code>. * @exception UnsupportedOperationException if <code>image</code> * contains a <code>Raster</code> and <code>canWriteRasters</code> * returns <code>false</code>. * @exception IOException if an error occurs during writing. */ public void write(IIOImage image) throws IOException { write(null, image, null); } /** * Appends a complete image stream consisting of a single image * with default metadata and thumbnails to the output. This * method is a shorthand for <code>write(null, new IIOImage(image, * null, null), null)</code>. * * @param image a <code>RenderedImage</code> to be written. * * @exception IllegalStateException if the output has not * been set. * @exception IllegalArgumentException if <code>image</code> is * <code>null</code>. * @exception IOException if an error occurs during writing. */ public void write(RenderedImage image) throws IOException { write(null, new IIOImage(image, null, null), null); } // Check that the output has been set, then throw an // UnsupportedOperationException. private void unsupported() { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } throw new UnsupportedOperationException("Unsupported write variant!"); } // Sequence writes /** * Returns <code>true</code> if the writer is able to append an * image to an image stream that already contains header * information and possibly prior images. * * <p> If <code>canWriteSequence</code> returns <code>false</code>, * <code>writeToSequence</code> and <code>endWriteSequence</code> * will throw an <code>UnsupportedOperationException</code>. * * <p> The default implementation returns <code>false</code>. * * @return <code>true</code> if images may be appended sequentially. */ public boolean canWriteSequence() { return false; } /** * Prepares a stream to accept a series of subsequent * <code>writeToSequence</code> 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 <code>null</code>, * default stream metadata is used. * * <p> If the output is an <code>ImageOutputStream</code>, 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 <code>endWriteSequence</code> 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. * * <p> If <code>canWriteSequence</code> returns <code>false</code>, * this method will throw an * <code>UnsupportedOperationException</code>. * * <p> The output must have been set beforehand using either * the <code>setOutput</code> method. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise throws an * <code>UnsupportedOperationException</code>. * * @param streamMetadata A stream metadata object, or <code>null</code>. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if * <code>canWriteSequence</code> returns <code>false</code>. * @exception IOException if an error occurs writing the stream * metadata. */ public void prepareWriteSequence(IIOMetadata streamMetadata) throws IOException { unsupported(); } /** * Appends a single image and possibly associated metadata and * thumbnails, to the output. If the output is an * <code>ImageOutputStream</code>, 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 * <code>endWriteSequence</code> is called (<italic>e.g.</italic> TIFF). * * <p> If <code>canWriteSequence</code> returns <code>false</code>, * this method will throw an * <code>UnsupportedOperationException</code>. * * <p> The output must have been set beforehand using * the <code>setOutput</code> method. * * <p> <code>prepareWriteSequence</code> must have been called * beforehand, or an <code>IllegalStateException</code> is thrown. * * <p> If <code>canWriteRasters</code> returns <code>true</code>, * the <code>IIOImage</code> may contain a <code>Raster</code> * source. Otherwise, it must contain a * <code>RenderedImage</code> source. * * <p> 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. * * <p> An <code>ImageWriteParam</code> may optionally be supplied * to control the writing process. If <code>param</code> is * <code>null</code>, a default write param will be used. * * <p> If the supplied <code>ImageWriteParam</code> contains * optional setting values not supported by this writer (<i>e.g.</i> * progressive encoding or any format-specific settings), they * will be ignored. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise throws an * <code>UnsupportedOperationException</code>. * * @param image an <code>IIOImage</code> object containing an * image, thumbnails, and metadata to be written. * @param param an <code>ImageWriteParam</code>, or * <code>null</code> to use a default * <code>ImageWriteParam</code>. * * @exception IllegalStateException if the output has not * been set, or <code>prepareWriteSequence</code> has not been called. * @exception UnsupportedOperationException if * <code>canWriteSequence</code> returns <code>false</code>. * @exception IllegalArgumentException if <code>image</code> is * <code>null</code>. * @exception UnsupportedOperationException if <code>image</code> * contains a <code>Raster</code> and <code>canWriteRasters</code> * returns <code>false</code>. * @exception IOException if an error occurs during writing. */ public void writeToSequence(IIOImage image, ImageWriteParam param) throws IOException { unsupported(); } /** * Completes the writing of a sequence of images begun with * <code>prepareWriteSequence</code>. 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 * <code>ImageOutputStream</code>, data through the stream metadata * at the end of the sequence are flushed and need not be readable * or writable. * * <p> If <code>canWriteSequence</code> returns <code>false</code>, * this method will throw an * <code>UnsupportedOperationException</code>. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise throws an * <code>UnsupportedOperationException</code>. * * @exception IllegalStateException if the output has not * been set, or <code>prepareWriteSequence</code> has not been called. * @exception UnsupportedOperationException if * <code>canWriteSequence</code> returns <code>false</code>. * @exception IOException if an error occurs during writing. */ public void endWriteSequence() throws IOException { unsupported(); } // Metadata replacement /** * Returns <code>true</code> if it is possible to replace the * stream metadata already present in the output. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise returns <code>false</code>. * * @return <code>true</code> if replacement of stream metadata is * allowed. * * @exception IllegalStateException if the output has not * been set. * @exception IOException if an I/O error occurs during the query. */ public boolean canReplaceStreamMetadata() throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * Replaces the stream metadata in the output with new * information. If the output is an * <code>ImageOutputStream</code>, 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. * * <p> If <code>canReplaceStreamMetadata</code> returns * <code>false</code>, an * <code>UnsupportedOperationException</code> will be thrown. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise throws an * <code>UnsupportedOperationException</code>. * * @param streamMetadata an <code>IIOMetadata</code> object representing * stream metadata, or <code>null</code> to use default values. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if the * <code>canReplaceStreamMetadata</code> returns * <code>false</code>. modes do not include * @exception IOException if an error occurs during writing. */ public void replaceStreamMetadata(IIOMetadata streamMetadata) throws IOException { unsupported(); } /** * Returns <code>true</code> if it is possible to replace the * image metadata associated with an existing image with index * <code>imageIndex</code>. If this method returns * <code>false</code>, a call to * <code>replaceImageMetadata(imageIndex)</code> will throw an * <code>UnsupportedOperationException</code>. * * <p> A writer that does not support any image metadata * replacement may return <code>false</code> without performing * bounds checking on the index. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise returns <code>false</code> * without checking the value of <code>imageIndex</code>. * * @param imageIndex the index of the image whose metadata is to * be replaced. * * @return <code>true</code> if the image metadata of the given * image can be replaced. * * @exception IllegalStateException if the output has not * been set. * @exception IndexOutOfBoundsException if the writer supports * image metadata replacement in general, but * <code>imageIndex</code> is less than 0 or greater than the * largest available index. * @exception IOException if an I/O error occurs during the query. */ public boolean canReplaceImageMetadata(int imageIndex) throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * Replaces the image metadata associated with an existing image. * * <p> If <code>canReplaceImageMetadata(imageIndex)</code> returns * <code>false</code>, an * <code>UnsupportedOperationException</code> will be thrown. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise throws an * <code>UnsupportedOperationException</code>. * * @param imageIndex the index of the image whose metadata is to * be replaced. * @param imageMetadata an <code>IIOMetadata</code> object * representing image metadata, or <code>null</code>. * * @exception IllegalStateException if the output has not been * set. * @exception UnsupportedOperationException if * <code>canReplaceImageMetadata</code> returns * <code>false</code>. * @exception IndexOutOfBoundsException if <code>imageIndex</code> * is less than 0 or greater than the largest available index. * @exception IOException if an error occurs during writing. */ public void replaceImageMetadata(int imageIndex, IIOMetadata imageMetadata) throws IOException { unsupported(); } // Image insertion /** * Returns <code>true</code> 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 * <code>imageIndex</code> of <code>-1</code> may be used to * signify an index one larger than the current largest index. * * <p> A writer that does not support any image insertion may * return <code>false</code> without performing bounds checking on * the index. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise returns <code>false</code> * withour checking the value of <code>imageIndex</code>. * * @param imageIndex the index at which the image is to be * inserted. * * @return <code>true</code> if an image may be inserted at the * given index. * * @exception IllegalStateException if the output has not * been set. * @exception IndexOutOfBoundsException if the writer supports * image insertion in general, but <code>imageIndex</code> is less * than -1 or greater than the largest available index. * @exception IOException if an I/O error occurs during the query. */ public boolean canInsertImage(int imageIndex) throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * Inserts a new image into an existing image stream. Existing * images with an index greater than <code>imageIndex</code> are * preserved, and their indices are each increased by 1. A value * for <code>imageIndex</code> 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 <code>ImageOutputStream</code>, * the entirety of the stream must be both readable and writeable. * * <p> If <code>canInsertImage(imageIndex)</code> returns * <code>false</code>, an * <code>UnsupportedOperationException</code> will be thrown. * * <p> An <code>ImageWriteParam</code> may optionally be supplied * to control the writing process. If <code>param</code> is * <code>null</code>, a default write param will be used. * * <p> If the supplied <code>ImageWriteParam</code> contains * optional setting values not supported by this writer (<i>e.g.</i> * progressive encoding or any format-specific settings), they * will be ignored. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise throws an * <code>UnsupportedOperationException</code>. * * @param imageIndex the index at which to write the image. * @param image an <code>IIOImage</code> object containing an * image, thumbnails, and metadata to be written. * @param param an <code>ImageWriteParam</code>, or * <code>null</code> to use a default * <code>ImageWriteParam</code>. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if * <code>canInsertImage(imageIndex)</code> returns <code>false</code>. * @exception IllegalArgumentException if <code>image</code> is * <code>null</code>. * @exception IndexOutOfBoundsException if <code>imageIndex</code> * is less than -1 or greater than the largest available index. * @exception UnsupportedOperationException if <code>image</code> * contains a <code>Raster</code> and <code>canWriteRasters</code> * returns <code>false</code>. * @exception IOException if an error occurs during writing. */ public void writeInsert(int imageIndex, IIOImage image, ImageWriteParam param) throws IOException { unsupported(); }Lines 501–1000 of 2037. Previous lines Load more
IIOMetadata streamMetadata, IIOMetadata imageMetadata) { return null; } /** * Returns <code>true</code> if the methods that take an * <code>IIOImage</code> parameter are capable of dealing with a * <code>Raster</code> (as opposed to <code>RenderedImage</code>) * source image. If this method returns <code>false</code>, then * those methods will throw an * <code>UnsupportedOperationException</code> if supplied with an * <code>IIOImage</code> containing a <code>Raster</code>. * * <p> The default implementation returns <code>false</code>. * * @return <code>true</code> if <code>Raster</code> sources are * supported. */ public boolean canWriteRasters() { return false; } /** * 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 <code>ImageOutputStream</code>, its existing * contents prior to the current seek position are not affected, * and need not be readable or writable. * * <p> The output must have been set beforehand using the * <code>setOutput</code> method. * * <p> Stream metadata may optionally be supplied; if it is * <code>null</code>, default stream metadata will be used. * * <p> If <code>canWriteRasters</code> returns <code>true</code>, * the <code>IIOImage</code> may contain a <code>Raster</code> * source. Otherwise, it must contain a * <code>RenderedImage</code> source. * * <p> 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. * * <p> An <code>ImageWriteParam</code> may * optionally be supplied to control the writing process. If * <code>param</code> is <code>null</code>, a default write param * will be used. * * <p> If the supplied <code>ImageWriteParam</code> contains * optional setting values not supported by this writer (<i>e.g.</i> * progressive encoding or any format-specific settings), they * will be ignored. * * @param streamMetadata an <code>IIOMetadata</code> object representing * stream metadata, or <code>null</code> to use default values. * @param image an <code>IIOImage</code> object containing an * image, thumbnails, and metadata to be written. * @param param an <code>ImageWriteParam</code>, or * <code>null</code> to use a default * <code>ImageWriteParam</code>. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if <code>image</code> * contains a <code>Raster</code> and <code>canWriteRasters</code> * returns <code>false</code>. * @exception IllegalArgumentException if <code>image</code> is * <code>null</code>. * @exception IOException if an error occurs during writing. */ public abstract void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) throws IOException; /** * Appends a complete image stream containing a single image with * default metadata and thumbnails to the output. This method is * a shorthand for <code>write(null, image, null)</code>. * * @param image an <code>IIOImage</code> object containing an * image, thumbnails, and metadata to be written. * * @exception IllegalStateException if the output has not * been set. * @exception IllegalArgumentException if <code>image</code> is * <code>null</code>. * @exception UnsupportedOperationException if <code>image</code> * contains a <code>Raster</code> and <code>canWriteRasters</code> * returns <code>false</code>. * @exception IOException if an error occurs during writing. */ public void write(IIOImage image) throws IOException { write(null, image, null); } /** * Appends a complete image stream consisting of a single image * with default metadata and thumbnails to the output. This * method is a shorthand for <code>write(null, new IIOImage(image, * null, null), null)</code>. * * @param image a <code>RenderedImage</code> to be written. * * @exception IllegalStateException if the output has not * been set. * @exception IllegalArgumentException if <code>image</code> is * <code>null</code>. * @exception IOException if an error occurs during writing. */ public void write(RenderedImage image) throws IOException { write(null, new IIOImage(image, null, null), null); } // Check that the output has been set, then throw an // UnsupportedOperationException. private void unsupported() { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } throw new UnsupportedOperationException("Unsupported write variant!"); } // Sequence writes /** * Returns <code>true</code> if the writer is able to append an * image to an image stream that already contains header * information and possibly prior images. * * <p> If <code>canWriteSequence</code> returns <code>false</code>, * <code>writeToSequence</code> and <code>endWriteSequence</code> * will throw an <code>UnsupportedOperationException</code>. * * <p> The default implementation returns <code>false</code>. * * @return <code>true</code> if images may be appended sequentially. */ public boolean canWriteSequence() { return false; } /** * Prepares a stream to accept a series of subsequent * <code>writeToSequence</code> 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 <code>null</code>, * default stream metadata is used. * * <p> If the output is an <code>ImageOutputStream</code>, 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 <code>endWriteSequence</code> 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. * * <p> If <code>canWriteSequence</code> returns <code>false</code>, * this method will throw an * <code>UnsupportedOperationException</code>. * * <p> The output must have been set beforehand using either * the <code>setOutput</code> method. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise throws an * <code>UnsupportedOperationException</code>. * * @param streamMetadata A stream metadata object, or <code>null</code>. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if * <code>canWriteSequence</code> returns <code>false</code>. * @exception IOException if an error occurs writing the stream * metadata. */ public void prepareWriteSequence(IIOMetadata streamMetadata) throws IOException { unsupported(); } /** * Appends a single image and possibly associated metadata and * thumbnails, to the output. If the output is an * <code>ImageOutputStream</code>, 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 * <code>endWriteSequence</code> is called (<italic>e.g.</italic> TIFF). * * <p> If <code>canWriteSequence</code> returns <code>false</code>, * this method will throw an * <code>UnsupportedOperationException</code>. * * <p> The output must have been set beforehand using * the <code>setOutput</code> method. * * <p> <code>prepareWriteSequence</code> must have been called * beforehand, or an <code>IllegalStateException</code> is thrown. * * <p> If <code>canWriteRasters</code> returns <code>true</code>, * the <code>IIOImage</code> may contain a <code>Raster</code> * source. Otherwise, it must contain a * <code>RenderedImage</code> source. * * <p> 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. * * <p> An <code>ImageWriteParam</code> may optionally be supplied * to control the writing process. If <code>param</code> is * <code>null</code>, a default write param will be used. * * <p> If the supplied <code>ImageWriteParam</code> contains * optional setting values not supported by this writer (<i>e.g.</i> * progressive encoding or any format-specific settings), they * will be ignored. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise throws an * <code>UnsupportedOperationException</code>. * * @param image an <code>IIOImage</code> object containing an * image, thumbnails, and metadata to be written. * @param param an <code>ImageWriteParam</code>, or * <code>null</code> to use a default * <code>ImageWriteParam</code>. * * @exception IllegalStateException if the output has not * been set, or <code>prepareWriteSequence</code> has not been called. * @exception UnsupportedOperationException if * <code>canWriteSequence</code> returns <code>false</code>. * @exception IllegalArgumentException if <code>image</code> is * <code>null</code>. * @exception UnsupportedOperationException if <code>image</code> * contains a <code>Raster</code> and <code>canWriteRasters</code> * returns <code>false</code>. * @exception IOException if an error occurs during writing. */ public void writeToSequence(IIOImage image, ImageWriteParam param) throws IOException { unsupported(); } /** * Completes the writing of a sequence of images begun with * <code>prepareWriteSequence</code>. 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 * <code>ImageOutputStream</code>, data through the stream metadata * at the end of the sequence are flushed and need not be readable * or writable. * * <p> If <code>canWriteSequence</code> returns <code>false</code>, * this method will throw an * <code>UnsupportedOperationException</code>. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise throws an * <code>UnsupportedOperationException</code>. * * @exception IllegalStateException if the output has not * been set, or <code>prepareWriteSequence</code> has not been called. * @exception UnsupportedOperationException if * <code>canWriteSequence</code> returns <code>false</code>. * @exception IOException if an error occurs during writing. */ public void endWriteSequence() throws IOException { unsupported(); } // Metadata replacement /** * Returns <code>true</code> if it is possible to replace the * stream metadata already present in the output. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise returns <code>false</code>. * * @return <code>true</code> if replacement of stream metadata is * allowed. * * @exception IllegalStateException if the output has not * been set. * @exception IOException if an I/O error occurs during the query. */ public boolean canReplaceStreamMetadata() throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * Replaces the stream metadata in the output with new * information. If the output is an * <code>ImageOutputStream</code>, 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. * * <p> If <code>canReplaceStreamMetadata</code> returns * <code>false</code>, an * <code>UnsupportedOperationException</code> will be thrown. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise throws an * <code>UnsupportedOperationException</code>. * * @param streamMetadata an <code>IIOMetadata</code> object representing * stream metadata, or <code>null</code> to use default values. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if the * <code>canReplaceStreamMetadata</code> returns * <code>false</code>. modes do not include * @exception IOException if an error occurs during writing. */ public void replaceStreamMetadata(IIOMetadata streamMetadata) throws IOException { unsupported(); } /** * Returns <code>true</code> if it is possible to replace the * image metadata associated with an existing image with index * <code>imageIndex</code>. If this method returns * <code>false</code>, a call to * <code>replaceImageMetadata(imageIndex)</code> will throw an * <code>UnsupportedOperationException</code>. * * <p> A writer that does not support any image metadata * replacement may return <code>false</code> without performing * bounds checking on the index. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise returns <code>false</code> * without checking the value of <code>imageIndex</code>. * * @param imageIndex the index of the image whose metadata is to * be replaced. * * @return <code>true</code> if the image metadata of the given * image can be replaced. * * @exception IllegalStateException if the output has not * been set. * @exception IndexOutOfBoundsException if the writer supports * image metadata replacement in general, but * <code>imageIndex</code> is less than 0 or greater than the * largest available index. * @exception IOException if an I/O error occurs during the query. */ public boolean canReplaceImageMetadata(int imageIndex) throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * Replaces the image metadata associated with an existing image. * * <p> If <code>canReplaceImageMetadata(imageIndex)</code> returns * <code>false</code>, an * <code>UnsupportedOperationException</code> will be thrown. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise throws an * <code>UnsupportedOperationException</code>. * * @param imageIndex the index of the image whose metadata is to * be replaced. * @param imageMetadata an <code>IIOMetadata</code> object * representing image metadata, or <code>null</code>. * * @exception IllegalStateException if the output has not been * set. * @exception UnsupportedOperationException if * <code>canReplaceImageMetadata</code> returns * <code>false</code>. * @exception IndexOutOfBoundsException if <code>imageIndex</code> * is less than 0 or greater than the largest available index. * @exception IOException if an error occurs during writing. */ public void replaceImageMetadata(int imageIndex, IIOMetadata imageMetadata) throws IOException { unsupported(); } // Image insertion /** * Returns <code>true</code> 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 * <code>imageIndex</code> of <code>-1</code> may be used to * signify an index one larger than the current largest index. * * <p> A writer that does not support any image insertion may * return <code>false</code> without performing bounds checking on * the index. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise returns <code>false</code> * withour checking the value of <code>imageIndex</code>. * * @param imageIndex the index at which the image is to be * inserted. * * @return <code>true</code> if an image may be inserted at the * given index. * * @exception IllegalStateException if the output has not * been set. * @exception IndexOutOfBoundsException if the writer supports * image insertion in general, but <code>imageIndex</code> is less * than -1 or greater than the largest available index. * @exception IOException if an I/O error occurs during the query. */ public boolean canInsertImage(int imageIndex) throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * Inserts a new image into an existing image stream. Existing * images with an index greater than <code>imageIndex</code> are * preserved, and their indices are each increased by 1. A value * for <code>imageIndex</code> 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 <code>ImageOutputStream</code>, * the entirety of the stream must be both readable and writeable. * * <p> If <code>canInsertImage(imageIndex)</code> returns * <code>false</code>, an * <code>UnsupportedOperationException</code> will be thrown. * * <p> An <code>ImageWriteParam</code> may optionally be supplied * to control the writing process. If <code>param</code> is * <code>null</code>, a default write param will be used. * * <p> If the supplied <code>ImageWriteParam</code> contains * optional setting values not supported by this writer (<i>e.g.</i> * progressive encoding or any format-specific settings), they * will be ignored. * * <p> The default implementation throws an * <code>IllegalStateException</code> if the output is * <code>null</code>, and otherwise throws an * <code>UnsupportedOperationException</code>. * * @param imageIndex the index at which to write the image. * @param image an <code>IIOImage</code> object containing an * image, thumbnails, and metadata to be written. * @param param an <code>ImageWriteParam</code>, or * <code>null</code> to use a default * <code>ImageWriteParam</code>. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if * <code>canInsertImage(imageIndex)</code> returns <code>false</code>. * @exception IllegalArgumentException if <code>image</code> is * <code>null</code>. * @exception IndexOutOfBoundsException if <code>imageIndex</code> * is less than -1 or greater than the largest available index. * @exception UnsupportedOperationException if <code>image</code> * contains a <code>Raster</code> and <code>canWriteRasters</code> * returns <code>false</code>. * @exception IOException if an error occurs during writing. */ public void writeInsert(int imageIndex, IIOImage image, ImageWriteParam param) throws IOException { unsupported(); }