- All Implemented Interfaces:
AutoCloseable
,ISWriterOps
ZipDocWriter
ZipDocWriter) with an
embedded media type of image/vnd.bzdev.image-sequence+zip. This
format is a ZIP file with the following entries:
- META-INF/ is the first entry in the ZIP file and represents a directory named META-INF. The length for the data it contains is zero, and it has an extra header field whose length is 34, whose type is 0xFACE (in little-endian byte order), and whose value is "image/vnd.bzdev.image-sequence+zip".
- META-INF/metadata contains several lines, each starting
with a name, followed immediately by a colon and a space
(": "), and then followed immediately by a value:
- Frame-Width: WIDTH
- Frame-Height: HEIGHT
- Frame-Media-Type: MEDIA_TYPE
- Frame-Rate: RATE
- Entry-Format: FORMAT
- images/NameN.EXT is a series of images, added to the ZIP file in the order in which they should be shown, where Name is the initial portion of an image-file name, N is a 0-padded fixed-width integer-valued sequence number starting at 1, and EXT is the file extension corresponding to the mime type. For example, images/img001.png is a suitable name for the first image in a sequence of no more than 999 PNG images.
Bytes 0 to 3: 50 4B 03 04 Bytes 8 to 9: 00 00 Bytes 14 to 25: 00 00 00 00 00 00 00 00 00 00 00 00 Bytes 26 to 27: 09 00 Bytes 28 to 29: (2 + the length of the media type) in little-endian byte order; a larger value if other information is included Bytes 30 to 38: the characters "META-INF/" (in UTF-8 encoding) Bytes 39 to 40: CE FA (0xFACE in little-endian byte order) Bytes 41 to 42: 02 02 (the number 34 in little-endian byte order) Bytes 43 to 76: image/vnd.bzdev.image-sequence+zip (the characters making up the media type encoded using UTF-8, without a terminating null character)
The method
addMetadata(int, int, String,String)
or
addMetadata(int, int, String,double,String)
must be called before the call to close()
, and must be
called before any images are added. The method
ZipDocWriter.nextOutputStream(String,boolean,int)
,
ZipDocWriter.nextOutputStream(String,boolean,int,int)
,
nextOutputStream(String,boolean,int,byte[])
,
nextOutputStream(String,boolean,int,int,byte[])
,
nextOutputStream(boolean,int)
,
nextOutputStream(boolean,int,byte[])
,
nextOutputStream(boolean,int,int)
,
nextOutputStream(boolean,int,int,byte[])
,
nextOutputStreamGraphics()
,
nextOutputStreamGraphics(String)
,
nextOutputStreamGraphics(String, int)
,
nextOutputStreamGraphics(boolean,int)
,
nextOutputStreamGraphics(boolean,int,byte[])
,
nextOutputStreamGraphics(int)
,
nextOutputStreamGraphics(boolean,int,int)
, or
nextOutputStreamGraphics(boolean,int,int,byte[])
must be used to create each of the images - these methods return
either an output stream that is used to store the image or an
instance of OutputStreamGraphics that allows the image to be drawn.
Only the first eight of these methods returns an output stream
directly. The stream or OSGraphicsOps object that is returned
should be explicitly closed when the image is completely written,
and only one image can be written at a time.
The methods
ZipDocWriter.nextOutputStream(String,boolean,int,int)
and
ZipDocWriter.nextOutputStream(String,boolean,int,int,byte[])
allows a count indicating that count
entry
names will appear in the output stream and share the same image. In these
cases (ones in which the method's first argument is an entry name),
repeatFile(String)
must be called
count-1
times before the next output stream is created.
For the other methods named nextOutputStream
and for the methods
named nextOutputStreamGraphics
, repeatFile(String)
must not be called as its use is implicit.
When the last image is complete
close
must be called.
Note: Due to a change in IETF nomenclature, the term "media type" is now used for what was previously called a MIME (Multipurpose Internet Mail Extensions) type.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.bzdev.gio.ISWriterOps
ISWriterOps.AnimationParameters
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor given a file.Constructor given an output stream.ImageSequenceWriter
(String fileName) Constructor given a file name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMetadata
(int frameWidth, int frameHeight, double frameRate) Add the metadata entry without a media type and without a format string.void
addMetadata
(int frameWidth, int frameHeight, String frameMimeType) Add the metadata entry without a frame rate and format.void
addMetadata
(int frameWidth, int frameHeight, String frameMimeType, double frameRate, String format) Add the metadata entry in full.void
addMetadata
(int frameWidth, int frameHeight, String frameMimeType, String format) Add the metadata entry without a frame rate.void
close()
Close the writer.int
Get the frame height.int
Get the frame width.boolean
Test if metadata was added.nextOutputStream
(boolean compressed, int level) Get an output stream for the next entry with an automatically generated name.nextOutputStream
(boolean compressed, int level, byte[] extra) Get an output stream for the next entry with an automatically generated name and set an extra field.nextOutputStream
(boolean compressed, int level, int count) Get an output stream with a repetition count for the next entry, providing an automatically generated entry name.nextOutputStream
(boolean compressed, int level, int count, byte[] extra) Get an output stream with a repetition count for the next entry, specifying an extra field and providing an automatically generated entry name.nextOutputStream
(String name, boolean compressed, int level, byte[] extra) Get an output stream for the next entry and set an extra field.nextOutputStream
(String name, boolean compressed, int level, int count, byte[] extra) Get an output stream with a repetition count for the next entry, specifying an extra field.Create a graphics output stream for drawing an image.nextOutputStreamGraphics
(boolean compressed, int level) Create a graphics output stream for drawing an image, specifying how the image should be stored.nextOutputStreamGraphics
(boolean compressed, int level, byte[] extra) Create a graphics output stream for drawing an image, specifying how the image should be stored and providing an extra field.nextOutputStreamGraphics
(boolean compressed, int level, int count) Create a graphics output stream for drawing an image, specifying a repetition count and specifying how the image should be stored.nextOutputStreamGraphics
(boolean compressed, int level, int count, byte[] extra) Create a graphics output stream for drawing an image, specifying a repetition count, specifying how the image should be stored, and providing an extra field.nextOutputStreamGraphics
(int count) Create a graphics output stream for drawing an image, specifying a repetition count.Create a named graphics output stream for drawing an image.nextOutputStreamGraphics
(String name, int count) Create a named graphics output stream for drawing an image, specifying a repetition count.void
repeatFile
(String nextName) Provide the name for a repeated entry and create that entry.void
setEstimatedFrameCount
(int frameCount) Specify the estimated number of frames as an integer.void
setEstimatedFrameCount
(long frameCount) Specify the estimated number of frames as a long integer.Methods inherited from class org.bzdev.io.ZipDocWriter
nextOutputStream, nextOutputStream
-
Constructor Details
-
ImageSequenceWriter
Constructor given a file.- Parameters:
f
- the output file- Throws:
IOException
- an IO error occurredFileNotFoundException
- the filef
was not found
-
ImageSequenceWriter
Constructor given a file name.- Parameters:
fileName
- the output file name- Throws:
IOException
- an IO error occurredFileNotFoundException
- the filef
was not found
-
ImageSequenceWriter
Constructor given an output stream.- Parameters:
os
- the output stream- Throws:
IOException
- an IO error occurred
-
-
Method Details
-
addMetadata
public void addMetadata(int frameWidth, int frameHeight, String frameMimeType) throws IOException, IllegalStateException Add the metadata entry without a frame rate and format. A default format will be provided.- Specified by:
addMetadata
in interfaceISWriterOps
- Parameters:
frameWidth
- the frame width in pixelsframeHeight
- the frame height in pixelsframeMimeType
- the media type of the frames- Throws:
IOException
- and IO exception occurredIllegalStateException
- metadata was already added
-
addMetadata
public void addMetadata(int frameWidth, int frameHeight, String frameMimeType, String format) throws IOException, IllegalStateException Add the metadata entry without a frame rate. The format must exclude the initial "images" component of a path name. For example, the format "image%02d.png" will be used to generate entities whose names are "images/image01.png", "images/image02.png", etc. The caller is expected to provide the filename extension as shown in the example above.- Specified by:
addMetadata
in interfaceISWriterOps
- Parameters:
frameWidth
- the frame width in pixelsframeHeight
- the frame height in pixelsframeMimeType
- the media type of the framesformat
- the printf string that will produce the name of a ZIP entry containing an image given an integer- Throws:
IOException
- and IO exception occurredIllegalStateException
- metadata was already added
-
addMetadata
public void addMetadata(int frameWidth, int frameHeight, double frameRate) throws IOException, IllegalStateException Add the metadata entry without a media type and without a format string.- Specified by:
addMetadata
in interfaceISWriterOps
- Parameters:
frameWidth
- the frame width in pixelsframeHeight
- the frame height in pixelsframeRate
- the number of frames per second- Throws:
IOException
- and IO exception occurredIllegalStateException
- metadata was already added
-
metadataAdded
public boolean metadataAdded()Test if metadata was added.- Returns:
- true if an addMetadata method was previously called; false otherwise
-
getFrameWidth
public int getFrameWidth()Description copied from interface:ISWriterOps
Get the frame width. The frame width is the common width of all images in the sequence and is configured by a call toISWriterOps.addMetadata(int,int,String)
,ISWriterOps.addMetadata(int,int,String,String)
,ISWriterOps.addMetadata(int,int,double)
, orISWriterOps.addMetadata(int,int,String,double,String)
. If one of these methods has not been called, a value of zero will be returned.- Specified by:
getFrameWidth
in interfaceISWriterOps
- Returns:
- the frame width
-
getFrameHeight
public int getFrameHeight()Description copied from interface:ISWriterOps
Get the frame height. The frame height is the common width of all images in the sequence, and is configured by a call toISWriterOps.addMetadata(int,int,String)
,ISWriterOps.addMetadata(int,int,String,String)
,ISWriterOps.addMetadata(int,int,double)
, orISWriterOps.addMetadata(int,int,String,double,String)
. If one of these methods has not been called, a value of zero will be returned.- Specified by:
getFrameHeight
in interfaceISWriterOps
- Returns:
- the frame height
-
addMetadata
public void addMetadata(int frameWidth, int frameHeight, String frameMimeType, double frameRate, String format) throws IOException, IllegalStateException Add the metadata entry in full. The format must exclude the initial "images" component of a path name. For example, the format "image%02d.png" will be used to generate entities whose names are "images/image01.png", "images/image02.png", etc. The caller is expected to provide the filename extension as shown in the example above.- Specified by:
addMetadata
in interfaceISWriterOps
- Parameters:
frameWidth
- the frame width in pixelsframeHeight
- the frame height in pixelsframeMimeType
- the media type of the framesframeRate
- the number of frames per secondformat
- the printf string that will produce the name of a ZIP entry containing an image given an integer; null if this data is not provided- Throws:
IOException
- an IO error occurredIllegalStateException
- metadata was already added
-
setEstimatedFrameCount
public void setEstimatedFrameCount(int frameCount) Specify the estimated number of frames as an integer. The estimated frame count is an estimate of the number of images or frames in a sequence. This class ignores the value provided by this method.- Specified by:
setEstimatedFrameCount
in interfaceISWriterOps
- Parameters:
frameCount
- the number of frames; 0 for unknown
-
setEstimatedFrameCount
public void setEstimatedFrameCount(long frameCount) Specify the estimated number of frames as a long integer. The estimated frame count is an estimate of the number of images or frames in a sequence. This class ignores the value provided by this method.- Specified by:
setEstimatedFrameCount
in interfaceISWriterOps
- Parameters:
frameCount
- the number of frames; 0 for unknown
-
repeatFile
Description copied from class:ZipDocWriter
Provide the name for a repeated entry and create that entry. When an entry is created with a repetition count whose value iscount
in a call toZipDocWriter.nextOutputStream(String,boolean,int,int)
orZipDocWriter.nextOutputStream(String,boolean,int,int,byte[])
, then repeatFiles method must be calledcount-1
times before a another call to nextOutputStream or a call toZipDocWriter.close()
.- Overrides:
repeatFile
in classZipDocWriter
- Parameters:
nextName
- the name of a repeated entry- Throws:
IllegalArgumentException
- if the name of the stream is a reserved name or null, or if a subclass restricts the name in some wayIllegalStateException
- if repeatFile cannot be called at this point
-
nextOutputStream
public OutputStream nextOutputStream(String name, boolean compressed, int level, byte[] extra) throws IOException, IllegalArgumentException, IllegalStateException Description copied from class:ZipDocWriter
Get an output stream for the next entry and set an extra field.The caller must finish writing all the data for an entry and must close this output stream before calling nextOutputStream to get a new stream. The extra header field should not include the repetition-count data that this class (and its superclass) will provide.
Subclasses that need to override the the nextOutputStream methods will typically override this method and
ZipDocWriter.nextOutputStream(String,boolean,int,int,byte[])
.- Overrides:
nextOutputStream
in classZipDocWriter
- Parameters:
name
- the name of the entrycompressed
- true if the entry is compressed; false otherwiselevel
- the compression level when the entry is compressed (0 to 9 or the constants Deflator.BEST_COMPRESSION, Deflator.BEST_SPEED, or Deflator.DEFAULT_COMPRESSION, where Deflator is a class in the package java.util.zip)extra
- the extra field for a ZIP-file entry- Returns:
- the output stream to use for creating the next entry
- Throws:
IOException
- if an error occurred while writing the fileIllegalArgumentException
- if the name of the stream is a reserved name or null, or if a subclass restricts the name in some wayIllegalStateException
- if a repetition count has been previously specified andZipDocWriter.repeatFile(String)
has not been called the required number of times
-
nextOutputStream
public OutputStream nextOutputStream(boolean compressed, int level) throws IOException, IllegalArgumentException, IllegalStateException Get an output stream for the next entry with an automatically generated name.The caller must finish writing all the data for an entry and must close this output stream before calling nextOutputStream to get a new stream.
- Parameters:
compressed
- true if the entry is compressed; false otherwiselevel
- the compression level when the entry is compressed (0 to 9 or the constants Deflator.BEST_COMPRESSION, Deflator.BEST_SPEED, or Deflator.DEFAULT_COMPRESSION, where Deflator is a class in the package java.util.zip)- Returns:
- the output stream to use for creating the next entry
- Throws:
IOException
- if an error occurred while writing the fileIllegalArgumentException
- if the format string provided when addMetadata was called generated an illegal name or nullIllegalStateException
- if a repetition count has been previously specified andrepeatFile(String)
has not been called the required number of times
-
nextOutputStream
public OutputStream nextOutputStream(boolean compressed, int level, byte[] extra) throws IOException, IllegalArgumentException, IllegalStateException Get an output stream for the next entry with an automatically generated name and set an extra field.The caller must finish writing all the data for an entry and must close this output stream before calling nextOutputStream to get a new stream. The extra header field should not include the repetition-count data that this class (and its superclass) will provide.
- Parameters:
compressed
- true if the entry is compressed; false otherwiselevel
- the compression level when the entry is compressed (0 to 9 or the constants Deflator.BEST_COMPRESSION, Deflator.BEST_SPEED, or Deflator.DEFAULT_COMPRESSION, where Deflator is a class in the package java.util.zip)extra
- the extra field for a ZIP-file entry; null if there is none- Returns:
- the output stream to use for creating the next entry
- Throws:
IOException
- if an error occurred while writing the fileIllegalArgumentException
- if the format string provided when addMetadata was called generated an illegal name or nullIllegalStateException
- if a repetition count has been previously specified andrepeatFile(String)
has not been called the required number of times
-
nextOutputStream
public OutputStream nextOutputStream(String name, boolean compressed, int level, int count, byte[] extra) throws IOException, IllegalArgumentException, IllegalStateException Description copied from class:ZipDocWriter
Get an output stream with a repetition count for the next entry, specifying an extra field. A repetition count indicates that the entry represents a sequence of identical entries. It is indicated in the ZIP file being created by the presence of an extra header whose 16-bit length-field contains the value 4 and whose 16-bit ID is 0xFCDA, and whose value field is 32 bits long and contains the repetition count. Each field in this header is in little-endian order in order to match standard ZIP-file conventions.The caller must finish writing all the data for an entry and must close this output stream before calling nextOutputStream to get a new stream. The extra header field should not include the repetition-count data that this class (and its superclass) will provide.
Subclasses that need to override the the nextOutputStream methods will typically override this method and
ZipDocWriter.nextOutputStream(String,boolean,int,byte[])
.- Overrides:
nextOutputStream
in classZipDocWriter
- Parameters:
name
- the name of the entrycompressed
- true if the entry is compressed; false otherwiselevel
- the compression level when the entry is compressed (0 to 9 or the constants Deflator.BEST_COMPRESSION, Deflator.BEST_SPEED, or Deflator.DEFAULT_COMPRESSION, where Deflator is a class in the package java.util.zip)count
- the repetition count for this entry; ignored if the value is less than 1extra
- the extra field for the next entry- Returns:
- the output stream to use for creating the next entry
- Throws:
IOException
- if an error occurred while writing the fileIllegalArgumentException
- if the name of the stream is a reserved name or null, or if a subclass restricts the name in some wayIllegalStateException
- if a repetition count has been previously specified andZipDocWriter.repeatFile(String)
has not been called the required number of times
-
nextOutputStream
public OutputStream nextOutputStream(boolean compressed, int level, int count) throws IOException, IllegalArgumentException, IllegalStateException Get an output stream with a repetition count for the next entry, providing an automatically generated entry name. A repetition count indicates that the entry represents a sequence of identical entries. It is indicated in the ZIP file being created by the presence of an extra header whose 16-bit length-field contains the value 4 and whose 16-bit ID is 0xFCDA, and whose value field is 32 bits long and contains the repetition count. Each field in this header is in little-endian order in order to match standard ZIP-file conventions.The caller must finish writing all the data for an entry and must close this output stream before calling nextOutputStream to get a new stream.
The method
repeatFile(String)
must not be called explicitly when this method is used as it will provided the required number of calls torepeatFile(String)
.- Parameters:
compressed
- true if the entry is compressed; false otherwiselevel
- the compression level when the entry is compressed (0 to 9 or the constants Deflator.BEST_COMPRESSION, Deflator.BEST_SPEED, or Deflator.DEFAULT_COMPRESSION, where Deflator is a class in the package java.util.zip)count
- the repetition count for this entry; ignored if the value is less than 1- Returns:
- the output stream to use for creating the next entry
- Throws:
IOException
- if an error occurred while writing the fileIllegalArgumentException
- if the format string provided when addMetadata was called generated an illegal name or nullIllegalStateException
- if a repetition count has been previously specified andrepeatFile(String)
has not been called the required number of times
-
nextOutputStream
public OutputStream nextOutputStream(boolean compressed, int level, int count, byte[] extra) throws IOException, IllegalArgumentException, IllegalStateException Get an output stream with a repetition count for the next entry, specifying an extra field and providing an automatically generated entry name. A repetition count indicates that the entry represents a sequence of identical entries. It is indicated in the ZIP file being created by the presence of an extra header whose 16-bit length-field contains the value 4 and whose 16-bit ID is 0xFCDA, and whose value field is 32 bits long and contains the repetition count. Each field in this header is in little-endian order in order to match standard ZIP-file conventions.The caller must finish writing all the data for an entry and must close this output stream before calling nextOutputStream to get a new stream.
The method
repeatFile(String)
must not be called explicitly when this method is used as it will provided the required number of calls torepeatFile(String)
. The extra header field should not include the repetition-count data that this class (and its superclass) will provide.- Parameters:
compressed
- true if the entry is compressed; false otherwiselevel
- the compression level when the entry is compressed (0 to 9 or the constants Deflator.BEST_COMPRESSION, Deflator.BEST_SPEED, or Deflator.DEFAULT_COMPRESSION, where Deflator is a class in the package java.util.zip)count
- the repetition count for this entry; ignored if the value is less than 1extra
- the extra field for the next entry; null if there is none- Returns:
- the output stream to use for creating the next entry
- Throws:
IOException
- if an error occurred while writing the fileIllegalArgumentException
- if the format string provided when addMetadata was called generated an illegal name or nullIllegalStateException
- if a repetition count has been previously specified andrepeatFile(String)
has not been called the required number of times
-
nextOutputStreamGraphics
public OSGraphicsOps nextOutputStreamGraphics(String name) throws IllegalStateException, IOException Create a named graphics output stream for drawing an image. To use this method, one will typically use the following design pattern:ImageSequenceWriter isw = new ImageSequenceWriter(...); OutputStreamGraphics osg = isw.nextOutputStreamGraphics(); Graphics2D g2d = osg.createGraphics(); // drawing operation using g2d ... g2d.displose(); osg.imageComplete(); osg.close();
- Specified by:
nextOutputStreamGraphics
in interfaceISWriterOps
- Parameters:
name
- the name of the output stream- Returns:
- a graphics output stream for drawing an image
- Throws:
IOException
- if an IO error occurredIllegalStateException
- if metadata missing
-
nextOutputStreamGraphics
Create a graphics output stream for drawing an image. To use this method, one will typically use the following design pattern:
Images will be stored without any compression and will be given a standard name.ImageSequenceWriter isw = new ImageSequenceWriter(...); OutputStreamGraphics osg = isw.nextOutputStreamGraphics(); Graphics2D g2d = osg.createGraphics(); // drawing operation using g2d ... g2d.displose(); osg.imageComplete(); osg.close();
- Specified by:
nextOutputStreamGraphics
in interfaceISWriterOps
- Returns:
- a graphics output stream for drawing an image
- Throws:
IOException
- if an IO error occurredIllegalStateException
- if metadata missing
-
nextOutputStreamGraphics
public OSGraphicsOps nextOutputStreamGraphics(boolean compressed, int level) throws IllegalStateException, IOException Create a graphics output stream for drawing an image, specifying how the image should be stored. To use this method, one will typically use the following design pattern:ImageSequenceWriter isw = new ImageSequenceWriter(...); OSGraphicsOps osg = isw.nextOutputStreamGraphics(...); Graphics2D g2d = osg.createGraphics(); // drawing operation using g2d ... g2d.displose(); osg.imageComplete(); osg.close();
- Parameters:
compressed
- true if the image should be compressed; false if it should be storedlevel
- the compression level (0 => no compression, 9 => maximum compression)- Returns:
- a graphics output stream for drawing an image
- Throws:
IOException
- if an IO error occurredIllegalStateException
- if metadata missing
-
nextOutputStreamGraphics
public OSGraphicsOps nextOutputStreamGraphics(boolean compressed, int level, byte[] extra) throws IllegalStateException, IOException Create a graphics output stream for drawing an image, specifying how the image should be stored and providing an extra field. To use this method, one will typically use the following design pattern:
The extra header field should not include the repetition-count data that this class (and its superclass) will provide.ImageSequenceWriter isw = new ImageSequenceWriter(...); OSGraphicsOps osg = isw.nextOutputStreamGraphics(...); Graphics2D g2d = osg.createGraphics(); // drawing operation using g2d ... g2d.displose(); osg.imageComplete(); osg.close();
- Parameters:
compressed
- true if the image should be compressed; false if it should be storedlevel
- the compression level (0 => no compression, 9 => maximum compression)extra
- a byte sequence to add to the extra field; null if there is none- Returns:
- a graphics output stream for drawing an image
- Throws:
IOException
- if an IO error occurredIllegalStateException
- if metadata missing
-
nextOutputStreamGraphics
public OSGraphicsOps nextOutputStreamGraphics(String name, int count) throws IllegalStateException, IOException Create a named graphics output stream for drawing an image, specifying a repetition count. To use this method, one will typically use the following design pattern:ImageSequenceWriter isw = new ImageSequenceWriter(...); OSGraphicsOps osg = isw.nextOutputStreamGraphics(...); Graphics2D g2d = osg.createGraphics(); // drawing operation using g2d ... g2d.displose(); osg.imageComplete(); osg.close();
The method
repeatFile(String)
should be called explicitly when this method is used as it will not provide the required number of calls torepeatFile(String)
.- Specified by:
nextOutputStreamGraphics
in interfaceISWriterOps
- Parameters:
count
- the repetition count for the entry corresponding to the graphics output stream that will be returnedname
- the name for this output stream- Returns:
- a graphics output stream for drawing an image
- Throws:
IOException
- if an IO error occurredIllegalStateException
- if metadata missing
-
nextOutputStreamGraphics
Create a graphics output stream for drawing an image, specifying a repetition count. To use this method, one will typically use the following design pattern:
Images will be stored without any compression and will be given a standard name.ImageSequenceWriter isw = new ImageSequenceWriter(...); OSGraphicsOps osg = isw.nextOutputStreamGraphics(...); Graphics2D g2d = osg.createGraphics(); // drawing operation using g2d ... g2d.displose(); osg.imageComplete(); osg.close();
The method
repeatFile(String)
should not be called explicitly when this method is used as it will provide the required number of calls torepeatFile(String)
.- Specified by:
nextOutputStreamGraphics
in interfaceISWriterOps
- Parameters:
count
- the repetition count for the entry corresponding to the graphics output stream that will be returned- Returns:
- a graphics output stream for drawing an image
- Throws:
IOException
- if an IO error occurredIllegalStateException
- if metadata missing
-
nextOutputStreamGraphics
public OSGraphicsOps nextOutputStreamGraphics(boolean compressed, int level, int count) throws IllegalStateException, IOException Create a graphics output stream for drawing an image, specifying a repetition count and specifying how the image should be stored. To use this method, one will typically use the following design pattern:ImageSequenceWriter isw = new ImageSequenceWriter(...); OSGraphicsOps osg = isw.nextOutputStreamGraphics(...); Graphics2D g2d = osg.createGraphics(); // drawing operation using g2d ... g2d.displose(); osg.imageComplete(); osg.close();
The method
repeatFile(String)
should not be called explicitly when this method is used as it will provided the required number of calls torepeatFile(String)
.- Parameters:
compressed
- true if the image should be compressed; false if it should be storedlevel
- the compression level (0 => no compression, 9 => maximum compression)count
- the repetition count for the entry corresponding to the graphics output stream that will be returned- Returns:
- a graphics output stream for drawing an image
- Throws:
IOException
- if an IO error occurredIllegalStateException
- if metadata missing
-
nextOutputStreamGraphics
public OSGraphicsOps nextOutputStreamGraphics(boolean compressed, int level, int count, byte[] extra) throws IllegalStateException, IOException Create a graphics output stream for drawing an image, specifying a repetition count, specifying how the image should be stored, and providing an extra field. To use this method, one will typically use the following design pattern:ImageSequenceWriter isw = new ImageSequenceriter(...); OSGraphicsOps osg = isw.nextOutputStreamGraphics(...); Graphics2D g2d = osg.createGraphics(); // drawing operation using g2d ... g2d.displose(); osg.imageComplete(); osg.close();
The method
repeatFile(String)
should not be called explicitly when this method is used as it will provided the required number of calls torepeatFile(String)
. The extra header field should not include the repetition-count data that this class (and its superclass) will provide.- Parameters:
compressed
- true if the image should be compressed; false if it should be storedlevel
- the compression level (0 => no compression, 9 => maximum compression)count
- the repetition count for the entry corresponding to the graphics output stream that will be returnedextra
- a byte sequence to add to the extra field; null if there is none- Returns:
- a graphics output stream for drawing an image
- Throws:
IOException
- if an IO error occurredIllegalStateException
- if metadata missing
-
close
Close the writer.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceISWriterOps
- Overrides:
close
in classZipDocWriter
- Throws:
IllegalStateException
- ifrepeatFile(String)
was not called the required number of times oraddMetadata(int,int,String)
,addMetadata(int,int,String,String)
, oraddMetadata(int,int,String,double,String)
, was not calledIOException
- if an error occurred while writing the ZIP file.IllegalStateException
- if metadata missing
-