// Image removal /** * Returns <code>true</code> 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. * * <p> A writer that does not support any image removal 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 to be removed. * * @return <code>true</code> if it is possible to remove the given * image. * * @exception IllegalStateException if the output has not * been set. * @exception IndexOutOfBoundsException if the writer supports * image removal 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 canRemoveImage(int imageIndex) throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * Removes an image from the stream. * * <p> If <code>canRemoveImage(imageIndex)</code> returns false, * an <code>UnsupportedOperationException</code>will be thrown. * * <p> The removal may or may not cause a reduction in the actual * file size. * * <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 to be removed. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if * <code>canRemoveImage(imageIndex)</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 I/O error occurs during the * removal. */ public void removeImage(int imageIndex) throws IOException { unsupported(); } // Empty images /** * Returns <code>true</code> 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 <code>replacePixels</code> methods. 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 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 the writing of complete image * stream with contents to be defined later is supported. * * @exception IllegalStateException if the output has not been * set. * @exception IOException if an I/O error occurs during the * query. */ public boolean canWriteEmpty() throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * 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 <code>replacePixels</code> * methods. 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 writing is not complete until a call to * <code>endWriteEmpty</code> occurs. Calls to * <code>prepareReplacePixels</code>, <code>replacePixels</code>, * and <code>endReplacePixels</code> may occur between calls to * <code>prepareWriteEmpty</code> and <code>endWriteEmpty</code>. * However, calls to <code>prepareWriteEmpty</code> cannot be * nested, and calls to <code>prepareWriteEmpty</code> and * <code>prepareInsertEmpty</code> may not be interspersed. * * <p> If <code>canWriteEmpty</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 streamMetadata an <code>IIOMetadata</code> object representing * stream metadata, or <code>null</code> to use default values. * @param imageType an <code>ImageTypeSpecifier</code> describing * the layout of the image. * @param width the width of the image. * @param height the height of the image. * @param imageMetadata an <code>IIOMetadata</code> object * representing image metadata, or <code>null</code>. * @param thumbnails a <code>List</code> of * <code>BufferedImage</code> thumbnails for this image, or * <code>null</code>. * @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>canWriteEmpty</code> returns <code>false</code>. * @exception IllegalStateException if a previous call to * <code>prepareWriteEmpty</code> has been made without a * corresponding call to <code>endWriteEmpty</code>. * @exception IllegalStateException if a previous call to * <code>prepareInsertEmpty</code> has been made without a * corresponding call to <code>endInsertEmpty</code>. * @exception IllegalArgumentException if <code>imageType</code> * is <code>null</code> or <code>thumbnails</code> contains * <code>null</code> references or objects other than * <code>BufferedImage</code>s. * @exception IllegalArgumentException if width or height are less * than 1. * @exception IOException if an I/O error occurs during writing. */ public void prepareWriteEmpty(IIOMetadata streamMetadata, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails, ImageWriteParam param) throws IOException { unsupported(); } /** * Completes the writing of a new image that was begun with a * prior call to <code>prepareWriteEmpty</code>. * * <p> If <code>canWriteEmpty()</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>. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if * <code>canWriteEmpty(imageIndex)</code> returns * <code>false</code>. * @exception IllegalStateException if a previous call to * <code>prepareWriteEmpty</code> without a corresponding call to * <code>endWriteEmpty</code> has not been made. * @exception IllegalStateException if a previous call to * <code>prepareInsertEmpty</code> without a corresponding call to * <code>endInsertEmpty</code> has been made. * @exception IllegalStateException if a call to * <code>prepareReiplacePixels</code> has been made without a * matching call to <code>endReplacePixels</code>. * @exception IOException if an I/O error occurs during writing. */ public void endWriteEmpty() throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } throw new IllegalStateException("No call to prepareWriteEmpty!"); } /** * Returns <code>true</code> 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 <code>replacePixels</code> methods. 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 insertion of empty images * 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 at which the image is to be * inserted. * * @return <code>true</code> if an empty image may be inserted at * the given index. * * @exception IllegalStateException if the output has not been * set. * @exception IndexOutOfBoundsException if the writer supports * empty 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 canInsertEmpty(int imageIndex) throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * Begins the insertion of a new image with undefined pixel values * 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> The image contents may be * supplied later using the <code>replacePixels</code> method. * The insertion is not complete until a call to * <code>endInsertEmpty</code> occurs. Calls to * <code>prepareReplacePixels</code>, <code>replacePixels</code>, * and <code>endReplacePixels</code> may occur between calls to * <code>prepareInsertEmpty</code> and * <code>endInsertEmpty</code>. However, calls to * <code>prepareInsertEmpty</code> cannot be nested, and calls to * <code>prepareWriteEmpty</code> and * <code>prepareInsertEmpty</code> may not be interspersed. * * <p> If <code>canInsertEmpty(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 imageType an <code>ImageTypeSpecifier</code> describing * the layout of the image. * @param width the width of the image. * @param height the height of the image. * @param imageMetadata an <code>IIOMetadata</code> object * representing image metadata, or <code>null</code>. * @param thumbnails a <code>List</code> of * <code>BufferedImage</code> thumbnails for this image, or * <code>null</code>. * @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>canInsertEmpty(imageIndex)</code> returns * <code>false</code>. * @exception IndexOutOfBoundsException if <code>imageIndex</code> * is less than -1 or greater than the largest available index. * @exception IllegalStateException if a previous call to * <code>prepareInsertEmpty</code> has been made without a * corresponding call to <code>endInsertEmpty</code>. * @exception IllegalStateException if a previous call to * <code>prepareWriteEmpty</code> has been made without a * corresponding call to <code>endWriteEmpty</code>. * @exception IllegalArgumentException if <code>imageType</code> * is <code>null</code> or <code>thumbnails</code> contains * <code>null</code> references or objects other than * <code>BufferedImage</code>s. * @exception IllegalArgumentException if width or height are less * than 1. * @exception IOException if an I/O error occurs during writing. */ public void prepareInsertEmpty(int imageIndex, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails, ImageWriteParam param) throws IOException { unsupported(); } /** * Completes the insertion of a new image that was begun with a * prior call to <code>prepareInsertEmpty</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. * @exception UnsupportedOperationException if * <code>canInsertEmpty(imageIndex)</code> returns * <code>false</code>. * @exception IllegalStateException if a previous call to * <code>prepareInsertEmpty</code> without a corresponding call to * <code>endInsertEmpty</code> has not been made. * @exception IllegalStateException if a previous call to * <code>prepareWriteEmpty</code> without a corresponding call to * <code>endWriteEmpty</code> has been made. * @exception IllegalStateException if a call to * <code>prepareReplacePixels</code> has been made without a * matching call to <code>endReplacePixels</code>. * @exception IOException if an I/O error occurs during writing. */ public void endInsertEmpty() throws IOException { unsupported(); } // Pixel replacement /** * Returns <code>true</code> if the writer allows pixels of the * given image to be replaced using the <code>replacePixels</code> * methods. * * <p> A writer that does not support any pixel 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 pixels are to be * replaced. * * @return <code>true</code> if the pixels of the given * image can be replaced. * * @exception IllegalStateException if the output has not been * set. * @exception IndexOutOfBoundsException if the writer supports * pixel 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 canReplacePixels(int imageIndex) throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * Prepares the writer to handle a series of calls to the * <code>replacePixels</code> methods. The affected pixel area * will be clipped against the supplied * * <p> If <code>canReplacePixels</code> returns * <code>false</code>, and * <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 pixels are to be * replaced. * @param region a <code>Rectangle</code> that will be used to clip * future pixel regions. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if * <code>canReplacePixels(imageIndex)</code> returns * <code>false</code>. * @exception IndexOutOfBoundsException if <code>imageIndex</code> * is less than 0 or greater than the largest available index. * @exception IllegalStateException if there is a previous call to * <code>prepareReplacePixels</code> without a matching call to * <code>endReplacePixels</code> (<i>i.e.</i>, nesting is not * allowed). * @exception IllegalArgumentException if <code>region</code> is * <code>null</code> or has a width or height less than 1. * @exception IOException if an I/O error occurs during the * preparation. */ public void prepareReplacePixels(int imageIndex, Rectangle region) throws IOException { unsupported(); } /** * 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. * * <p> The destination region is specified in the * <code>param</code> argument, and will be clipped to the image * boundaries and the region supplied to * <code>prepareReplacePixels</code>. At least one pixel of the * source must not be clipped, or an exception is 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> This method may only be called after a call to * <code>prepareReplacePixels</code>, or else an * <code>IllegalStateException</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 image a <code>RenderedImage</code> containing source * pixels. * @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>canReplacePixels(imageIndex)</code> returns * <code>false</code>. * @exception IllegalStateException if there is no previous call to * <code>prepareReplacePixels</code> without a matching call to * <code>endReplacePixels</code>. * @exception IllegalArgumentException if any of the following are true: * <ul> * <li> <code>image</code> is <code>null</code>. * <li> <code>param</code> is <code>null</code>. * <li> the intersected region does not contain at least one pixel. * <li> the layout of <code>image</code> does not match, or this * writer cannot convert it to, the existing image layout. * </ul> * @exception IOException if an I/O error occurs during writing. */ public void replacePixels(RenderedImage image, ImageWriteParam param) throws IOException { unsupported(); } /** * Replaces a portion of an image already present in the outputLines 1001–1500 of 2037. Previous lines Load more
// Image removal /** * Returns <code>true</code> 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. * * <p> A writer that does not support any image removal 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 to be removed. * * @return <code>true</code> if it is possible to remove the given * image. * * @exception IllegalStateException if the output has not * been set. * @exception IndexOutOfBoundsException if the writer supports * image removal 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 canRemoveImage(int imageIndex) throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * Removes an image from the stream. * * <p> If <code>canRemoveImage(imageIndex)</code> returns false, * an <code>UnsupportedOperationException</code>will be thrown. * * <p> The removal may or may not cause a reduction in the actual * file size. * * <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 to be removed. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if * <code>canRemoveImage(imageIndex)</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 I/O error occurs during the * removal. */ public void removeImage(int imageIndex) throws IOException { unsupported(); } // Empty images /** * Returns <code>true</code> 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 <code>replacePixels</code> methods. 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 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 the writing of complete image * stream with contents to be defined later is supported. * * @exception IllegalStateException if the output has not been * set. * @exception IOException if an I/O error occurs during the * query. */ public boolean canWriteEmpty() throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * 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 <code>replacePixels</code> * methods. 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 writing is not complete until a call to * <code>endWriteEmpty</code> occurs. Calls to * <code>prepareReplacePixels</code>, <code>replacePixels</code>, * and <code>endReplacePixels</code> may occur between calls to * <code>prepareWriteEmpty</code> and <code>endWriteEmpty</code>. * However, calls to <code>prepareWriteEmpty</code> cannot be * nested, and calls to <code>prepareWriteEmpty</code> and * <code>prepareInsertEmpty</code> may not be interspersed. * * <p> If <code>canWriteEmpty</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 streamMetadata an <code>IIOMetadata</code> object representing * stream metadata, or <code>null</code> to use default values. * @param imageType an <code>ImageTypeSpecifier</code> describing * the layout of the image. * @param width the width of the image. * @param height the height of the image. * @param imageMetadata an <code>IIOMetadata</code> object * representing image metadata, or <code>null</code>. * @param thumbnails a <code>List</code> of * <code>BufferedImage</code> thumbnails for this image, or * <code>null</code>. * @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>canWriteEmpty</code> returns <code>false</code>. * @exception IllegalStateException if a previous call to * <code>prepareWriteEmpty</code> has been made without a * corresponding call to <code>endWriteEmpty</code>. * @exception IllegalStateException if a previous call to * <code>prepareInsertEmpty</code> has been made without a * corresponding call to <code>endInsertEmpty</code>. * @exception IllegalArgumentException if <code>imageType</code> * is <code>null</code> or <code>thumbnails</code> contains * <code>null</code> references or objects other than * <code>BufferedImage</code>s. * @exception IllegalArgumentException if width or height are less * than 1. * @exception IOException if an I/O error occurs during writing. */ public void prepareWriteEmpty(IIOMetadata streamMetadata, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails, ImageWriteParam param) throws IOException { unsupported(); } /** * Completes the writing of a new image that was begun with a * prior call to <code>prepareWriteEmpty</code>. * * <p> If <code>canWriteEmpty()</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>. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if * <code>canWriteEmpty(imageIndex)</code> returns * <code>false</code>. * @exception IllegalStateException if a previous call to * <code>prepareWriteEmpty</code> without a corresponding call to * <code>endWriteEmpty</code> has not been made. * @exception IllegalStateException if a previous call to * <code>prepareInsertEmpty</code> without a corresponding call to * <code>endInsertEmpty</code> has been made. * @exception IllegalStateException if a call to * <code>prepareReiplacePixels</code> has been made without a * matching call to <code>endReplacePixels</code>. * @exception IOException if an I/O error occurs during writing. */ public void endWriteEmpty() throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } throw new IllegalStateException("No call to prepareWriteEmpty!"); } /** * Returns <code>true</code> 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 <code>replacePixels</code> methods. 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 insertion of empty images * 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 at which the image is to be * inserted. * * @return <code>true</code> if an empty image may be inserted at * the given index. * * @exception IllegalStateException if the output has not been * set. * @exception IndexOutOfBoundsException if the writer supports * empty 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 canInsertEmpty(int imageIndex) throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * Begins the insertion of a new image with undefined pixel values * 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> The image contents may be * supplied later using the <code>replacePixels</code> method. * The insertion is not complete until a call to * <code>endInsertEmpty</code> occurs. Calls to * <code>prepareReplacePixels</code>, <code>replacePixels</code>, * and <code>endReplacePixels</code> may occur between calls to * <code>prepareInsertEmpty</code> and * <code>endInsertEmpty</code>. However, calls to * <code>prepareInsertEmpty</code> cannot be nested, and calls to * <code>prepareWriteEmpty</code> and * <code>prepareInsertEmpty</code> may not be interspersed. * * <p> If <code>canInsertEmpty(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 imageType an <code>ImageTypeSpecifier</code> describing * the layout of the image. * @param width the width of the image. * @param height the height of the image. * @param imageMetadata an <code>IIOMetadata</code> object * representing image metadata, or <code>null</code>. * @param thumbnails a <code>List</code> of * <code>BufferedImage</code> thumbnails for this image, or * <code>null</code>. * @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>canInsertEmpty(imageIndex)</code> returns * <code>false</code>. * @exception IndexOutOfBoundsException if <code>imageIndex</code> * is less than -1 or greater than the largest available index. * @exception IllegalStateException if a previous call to * <code>prepareInsertEmpty</code> has been made without a * corresponding call to <code>endInsertEmpty</code>. * @exception IllegalStateException if a previous call to * <code>prepareWriteEmpty</code> has been made without a * corresponding call to <code>endWriteEmpty</code>. * @exception IllegalArgumentException if <code>imageType</code> * is <code>null</code> or <code>thumbnails</code> contains * <code>null</code> references or objects other than * <code>BufferedImage</code>s. * @exception IllegalArgumentException if width or height are less * than 1. * @exception IOException if an I/O error occurs during writing. */ public void prepareInsertEmpty(int imageIndex, ImageTypeSpecifier imageType, int width, int height, IIOMetadata imageMetadata, List<? extends BufferedImage> thumbnails, ImageWriteParam param) throws IOException { unsupported(); } /** * Completes the insertion of a new image that was begun with a * prior call to <code>prepareInsertEmpty</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. * @exception UnsupportedOperationException if * <code>canInsertEmpty(imageIndex)</code> returns * <code>false</code>. * @exception IllegalStateException if a previous call to * <code>prepareInsertEmpty</code> without a corresponding call to * <code>endInsertEmpty</code> has not been made. * @exception IllegalStateException if a previous call to * <code>prepareWriteEmpty</code> without a corresponding call to * <code>endWriteEmpty</code> has been made. * @exception IllegalStateException if a call to * <code>prepareReplacePixels</code> has been made without a * matching call to <code>endReplacePixels</code>. * @exception IOException if an I/O error occurs during writing. */ public void endInsertEmpty() throws IOException { unsupported(); } // Pixel replacement /** * Returns <code>true</code> if the writer allows pixels of the * given image to be replaced using the <code>replacePixels</code> * methods. * * <p> A writer that does not support any pixel 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 pixels are to be * replaced. * * @return <code>true</code> if the pixels of the given * image can be replaced. * * @exception IllegalStateException if the output has not been * set. * @exception IndexOutOfBoundsException if the writer supports * pixel 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 canReplacePixels(int imageIndex) throws IOException { if (getOutput() == null) { throw new IllegalStateException("getOutput() == null!"); } return false; } /** * Prepares the writer to handle a series of calls to the * <code>replacePixels</code> methods. The affected pixel area * will be clipped against the supplied * * <p> If <code>canReplacePixels</code> returns * <code>false</code>, and * <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 pixels are to be * replaced. * @param region a <code>Rectangle</code> that will be used to clip * future pixel regions. * * @exception IllegalStateException if the output has not * been set. * @exception UnsupportedOperationException if * <code>canReplacePixels(imageIndex)</code> returns * <code>false</code>. * @exception IndexOutOfBoundsException if <code>imageIndex</code> * is less than 0 or greater than the largest available index. * @exception IllegalStateException if there is a previous call to * <code>prepareReplacePixels</code> without a matching call to * <code>endReplacePixels</code> (<i>i.e.</i>, nesting is not * allowed). * @exception IllegalArgumentException if <code>region</code> is * <code>null</code> or has a width or height less than 1. * @exception IOException if an I/O error occurs during the * preparation. */ public void prepareReplacePixels(int imageIndex, Rectangle region) throws IOException { unsupported(); } /** * 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. * * <p> The destination region is specified in the * <code>param</code> argument, and will be clipped to the image * boundaries and the region supplied to * <code>prepareReplacePixels</code>. At least one pixel of the * source must not be clipped, or an exception is 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> This method may only be called after a call to * <code>prepareReplacePixels</code>, or else an * <code>IllegalStateException</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 image a <code>RenderedImage</code> containing source * pixels. * @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>canReplacePixels(imageIndex)</code> returns * <code>false</code>. * @exception IllegalStateException if there is no previous call to * <code>prepareReplacePixels</code> without a matching call to * <code>endReplacePixels</code>. * @exception IllegalArgumentException if any of the following are true: * <ul> * <li> <code>image</code> is <code>null</code>. * <li> <code>param</code> is <code>null</code>. * <li> the intersected region does not contain at least one pixel. * <li> the layout of <code>image</code> does not match, or this * writer cannot convert it to, the existing image layout. * </ul> * @exception IOException if an I/O error occurs during writing. */ public void replacePixels(RenderedImage image, ImageWriteParam param) throws IOException { unsupported(); } /** * Replaces a portion of an image already present in the output