public GifSequenceWriter(ImageOutputStream outputStream,int imageType,int timeBetweenFramesMS,boolean loopContinuously) throws IIOException, IOException {
  gifWriter=getWriter();
  imageWriteParam=gifWriter.getDefaultWriteParam();
  ImageTypeSpecifier imageTypeSpecifier=ImageTypeSpecifier.createFromBufferedImageType(imageType);
  imageMetaData=gifWriter.getDefaultImageMetadata(imageTypeSpecifier,imageWriteParam);
  String metaFormatName=imageMetaData.getNativeMetadataFormatName();
  IIOMetadataNode root=(IIOMetadataNode)imageMetaData.getAsTree(metaFormatName);
  IIOMetadataNode graphicsControlExtensionNode=getNode(root,"GraphicControlExtension");
  graphicsControlExtensionNode.setAttribute("disposalMethod","none");
  graphicsControlExtensionNode.setAttribute("userInputFlag","FALSE");
  graphicsControlExtensionNode.setAttribute("transparentColorFlag","FALSE");
  graphicsControlExtensionNode.setAttribute("delayTime",Integer.toString(timeBetweenFramesMS / 10));
  graphicsControlExtensionNode.setAttribute("transparentColorIndex","0");
  IIOMetadataNode commentsNode=getNode(root,"CommentExtensions");
  commentsNode.setAttribute("CommentExtension","Created by MAH");
  IIOMetadataNode appEntensionsNode=getNode(root,"ApplicationExtensions");
  IIOMetadataNode child=new IIOMetadataNode("ApplicationExtension");
  child.setAttribute("applicationID","NETSCAPE");
  child.setAttribute("authenticationCode","2.0");
  int loop=loopContinuously ? 0 : 1;
  child.setUserObject(new byte[]{0x1,(byte)(loop & 0xFF),(byte)((loop >> 8) & 0xFF)});
  appEntensionsNode.appendChild(child);
  imageMetaData.setFromTree(metaFormatName,root);
  gifWriter.setOutput(outputStream);
  gifWriter.prepareWriteSequence(null);
}

public GifSequenceWriter ( ImageOutputStream outputStream , int imageType , int timeBetweenFramesMS , boolean loopContinuously ) throws IIOException , IOException { gifWriter = getWriter ( ) ; imageWriteParam = gifWriter . getDefaultWriteParam ( ) ; ImageTypeSpecifier imageTypeSpecifier = ImageTypeSpecifier . createFromBufferedImageType ( imageType ) ; imageMetaData = gifWriter . getDefaultImageMetadata ( imageTypeSpecifier , imageWriteParam ) ; String metaFormatName = imageMetaData . getNativeMetadataFormatName ( ) ; IIOMetadataNode root = ( IIOMetadataNode ) imageMetaData . getAsTree ( metaFormatName ) ; IIOMetadataNode graphicsControlExtensionNode = getNode ( root , "GraphicControlExtension" ) ; graphicsControlExtensionNode . setAttribute ( "disposalMethod" , "none" ) ; graphicsControlExtensionNode . setAttribute ( "userInputFlag" , "FALSE" ) ; graphicsControlExtensionNode . setAttribute ( "transparentColorFlag" , "FALSE" ) ; graphicsControlExtensionNode . setAttribute ( "delayTime" , Integer . toString ( timeBetweenFramesMS / 10 ) ) ; graphicsControlExtensionNode . setAttribute ( "transparentColorIndex" , "0" ) ; IIOMetadataNode commentsNode = getNode ( root , "CommentExtensions" ) ; commentsNode . setAttribute ( "CommentExtension" , "Created by MAH" ) ; IIOMetadataNode appEntensionsNode = getNode ( root , "ApplicationExtensions" ) ; IIOMetadataNode child = new IIOMetadataNode ( "ApplicationExtension" ) ; child . setAttribute ( "applicationID" , "NETSCAPE" ) ; child . setAttribute ( "authenticationCode" , "2.0" ) ; int loop = loopContinuously ? 0 : 1 ; child . setUserObject ( new byte [ ] { 0x1 , ( byte ) ( loop & 0xFF ) , ( byte ) ( ( loop > > 8 ) & 0xFF ) } ) ; appEntensionsNode . appendChild ( child ) ; imageMetaData . setFromTree ( metaFormatName , root ) ; gifWriter . setOutput ( outputStream ) ; gifWriter . prepareWriteSequence ( null ) ; }
creates a new gifsequencewriter
