Package org.bzdev.gio

Class ImageSequenceWriter

java.lang.Object
org.bzdev.io.ZipDocWriter
org.bzdev.gio.ImageSequenceWriter
All Implemented Interfaces:
AutoCloseable, ISWriterOps

public class ImageSequenceWriter extends ZipDocWriter implements ISWriterOps
Writer for a simplified video format consisting of a sequence of images of the same type and dimensions. The writer produces a file or output stream in ZipDoc format (see 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
    where WIDTH is an integer specifying the width of each image in pixels, HEIGHT is an integer specifying the height of each image in pixels, MEDIA_TYPE is the media type of the images (historically, the media type), and RATE is a double-precision value giving the frame rate in units of frames per second. In addition, FORMAT is a string suitable for the C function printf for an integer argument to produce the name of the ZIP-file entry for an image, but without the initial "images/" string. The field Frame-Rate is optional; the other fields are required.
  • 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.
The file will contain the following bytes at the specified offsets:
 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.

  • Constructor Details

  • 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 interface ISWriterOps
      Parameters:
      frameWidth - the frame width in pixels
      frameHeight - the frame height in pixels
      frameMimeType - the media type of the frames
      Throws:
      IOException - and IO exception occurred
      IllegalStateException - 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 interface ISWriterOps
      Parameters:
      frameWidth - the frame width in pixels
      frameHeight - the frame height in pixels
      frameMimeType - the media type of the frames
      format - the printf string that will produce the name of a ZIP entry containing an image given an integer
      Throws:
      IOException - and IO exception occurred
      IllegalStateException - 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 interface ISWriterOps
      Parameters:
      frameWidth - the frame width in pixels
      frameHeight - the frame height in pixels
      frameRate - the number of frames per second
      Throws:
      IOException - and IO exception occurred
      IllegalStateException - 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 to ISWriterOps.addMetadata(int,int,String), ISWriterOps.addMetadata(int,int,String,String), ISWriterOps.addMetadata(int,int,double), or ISWriterOps.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 interface ISWriterOps
      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 to ISWriterOps.addMetadata(int,int,String), ISWriterOps.addMetadata(int,int,String,String), ISWriterOps.addMetadata(int,int,double), or ISWriterOps.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 interface ISWriterOps
      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 interface ISWriterOps
      Parameters:
      frameWidth - the frame width in pixels
      frameHeight - the frame height in pixels
      frameMimeType - the media type of the frames
      frameRate - the number of frames per second
      format - 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 occurred
      IllegalStateException - 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 interface ISWriterOps
      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 interface ISWriterOps
      Parameters:
      frameCount - the number of frames; 0 for unknown
    • repeatFile

      public void repeatFile(String nextName) throws IllegalArgumentException, IllegalStateException
      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 is count in a call to ZipDocWriter.nextOutputStream(String,boolean,int,int) or ZipDocWriter.nextOutputStream(String,boolean,int,int,byte[]), then repeatFiles method must be called count-1 times before a another call to nextOutputStream or a call to ZipDocWriter.close().
      Overrides:
      repeatFile in class ZipDocWriter
      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 way
      IllegalStateException - 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 class ZipDocWriter
      Parameters:
      name - the name of the entry
      compressed - true if the entry is compressed; false otherwise
      level - 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 file
      IllegalArgumentException - if the name of the stream is a reserved name or null, or if a subclass restricts the name in some way
      IllegalStateException - if a repetition count has been previously specified and ZipDocWriter.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 otherwise
      level - 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 file
      IllegalArgumentException - if the format string provided when addMetadata was called generated an illegal name or null
      IllegalStateException - if a repetition count has been previously specified and repeatFile(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 otherwise
      level - 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 file
      IllegalArgumentException - if the format string provided when addMetadata was called generated an illegal name or null
      IllegalStateException - if a repetition count has been previously specified and repeatFile(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 class ZipDocWriter
      Parameters:
      name - the name of the entry
      compressed - true if the entry is compressed; false otherwise
      level - 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
      extra - 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 file
      IllegalArgumentException - if the name of the stream is a reserved name or null, or if a subclass restricts the name in some way
      IllegalStateException - if a repetition count has been previously specified and ZipDocWriter.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 to repeatFile(String).

      Parameters:
      compressed - true if the entry is compressed; false otherwise
      level - 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 file
      IllegalArgumentException - if the format string provided when addMetadata was called generated an illegal name or null
      IllegalStateException - if a repetition count has been previously specified and repeatFile(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 to repeatFile(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 otherwise
      level - 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
      extra - 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 file
      IllegalArgumentException - if the format string provided when addMetadata was called generated an illegal name or null
      IllegalStateException - if a repetition count has been previously specified and repeatFile(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 interface ISWriterOps
      Parameters:
      name - the name of the output stream
      Returns:
      a graphics output stream for drawing an image
      Throws:
      IOException - if an IO error occurred
      IllegalStateException - if metadata missing
    • nextOutputStreamGraphics

      public OSGraphicsOps nextOutputStreamGraphics() throws IllegalStateException, IOException
      Create a 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();
       
      Images will be stored without any compression and will be given a standard name.
      Specified by:
      nextOutputStreamGraphics in interface ISWriterOps
      Returns:
      a graphics output stream for drawing an image
      Throws:
      IOException - if an IO error occurred
      IllegalStateException - 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 stored
      level - the compression level (0 => no compression, 9 => maximum compression)
      Returns:
      a graphics output stream for drawing an image
      Throws:
      IOException - if an IO error occurred
      IllegalStateException - 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:
          ImageSequenceWriter isw = new ImageSequenceWriter(...);
          OSGraphicsOps osg = isw.nextOutputStreamGraphics(...);
          Graphics2D g2d = osg.createGraphics();
          // drawing operation using g2d
          ...
          g2d.displose();
          osg.imageComplete();
          osg.close();
       
      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 stored
      level - 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 occurred
      IllegalStateException - 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 to repeatFile(String).

      Specified by:
      nextOutputStreamGraphics in interface ISWriterOps
      Parameters:
      count - the repetition count for the entry corresponding to the graphics output stream that will be returned
      name - the name for this output stream
      Returns:
      a graphics output stream for drawing an image
      Throws:
      IOException - if an IO error occurred
      IllegalStateException - if metadata missing
    • nextOutputStreamGraphics

      public OSGraphicsOps nextOutputStreamGraphics(int count) throws IllegalStateException, IOException
      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:
          ImageSequenceWriter isw = new ImageSequenceWriter(...);
          OSGraphicsOps osg = isw.nextOutputStreamGraphics(...);
          Graphics2D g2d = osg.createGraphics();
          // drawing operation using g2d
          ...
          g2d.displose();
          osg.imageComplete();
          osg.close();
       
      Images will be stored without any compression and will be given a standard name.

      The method repeatFile(String) should not be called explicitly when this method is used as it will provide the required number of calls to repeatFile(String).

      Specified by:
      nextOutputStreamGraphics in interface ISWriterOps
      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 occurred
      IllegalStateException - 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 to repeatFile(String).

      Parameters:
      compressed - true if the image should be compressed; false if it should be stored
      level - 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 occurred
      IllegalStateException - 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 to repeatFile(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 stored
      level - 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
      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 occurred
      IllegalStateException - if metadata missing
    • close

      public void close() throws IllegalStateException, IOException
      Close the writer.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface ISWriterOps
      Overrides:
      close in class ZipDocWriter
      Throws:
      IllegalStateException - if repeatFile(String) was not called the required number of times or addMetadata(int,int,String), addMetadata(int,int,String,String), or addMetadata(int,int,String,double,String), was not called
      IOException - if an error occurred while writing the ZIP file.
      IllegalStateException - if metadata missing