| 1 |
|
| 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 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
public class DoAction extends ControlTag { |
| 17 |
|
| 18 |
private Vector<Action> actions; |
| 19 |
|
| 20 |
public DoAction(Vector<Action> actions) { |
| 21 |
this(); |
| 22 |
this.actions = actions; |
| 23 |
} |
| 24 |
|
| 25 |
public DoAction() { |
| 26 |
super(12, 1); |
| 27 |
} |
| 28 |
|
| 29 |
public SWFTag read(int tagID, SWFInputStream swf, int len) |
| 30 |
throws IOException { |
| 31 |
|
| 32 |
DoAction tag = new DoAction(); |
| 33 |
tag.actions = new Vector<Action>(); |
| 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 = 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 |
} |