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
.
@param 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.