View Javadoc

1   // Copyright 2001, FreeHEP.
2   package org.freehep.graphicsio.swf;
3   
4   import java.io.IOException;
5   import java.util.Vector;
6   
7   import org.freehep.util.io.Action;
8   
9   /**
10   * DoInitAction TAG.
11   * 
12   * @author Mark Donszelmann
13   * @author Charles Loomis
14   * @version $Id: DoInitAction.java 8584 2006-08-10 23:06:37Z duns $
15   */
16  public class DoInitAction extends ControlTag {
17  
18      private Vector actions;
19  
20      public DoInitAction(Vector actions) {
21          this();
22          this.actions = actions;
23      }
24  
25      public DoInitAction() {
26          super(59, 6);
27      }
28  
29      public SWFTag read(int tagID, SWFInputStream swf, int len)
30              throws IOException {
31  
32          DoInitAction tag = new DoInitAction();
33          tag.actions = new Vector();
34          Action action = swf.readAction();
35          while (action != null) {
36              tag.actions.add(action);
37              action = swf.readAction();
38          }
39          return tag;
40      }
41  
42      public void write(int tagID, SWFOutputStream swf) throws IOException {
43          for (int i = 0; i < actions.size(); i++) {
44              Action a = (Action) actions.get(i);
45              swf.writeAction(a);
46          }
47          swf.writeAction(null);
48      }
49  
50      public String toString() {
51          StringBuffer s = new StringBuffer();
52          s.append(super.toString() + "\n");
53          for (int i = 0; i < actions.size(); i++) {
54              s.append("  " + actions.get(i) + "\n");
55          }
56          return s.toString();
57      }
58  }