| 1 |
|
| 2 |
package org.freehep.graphicsio.swf; |
| 3 |
|
| 4 |
import java.io.IOException; |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
public class ImportAssets extends ControlTag { |
| 14 |
|
| 15 |
private String url; |
| 16 |
|
| 17 |
private int[] tags; |
| 18 |
|
| 19 |
private String[] assets; |
| 20 |
|
| 21 |
public ImportAssets(String url, int[] tags, String[] assets) { |
| 22 |
this(); |
| 23 |
this.url = url; |
| 24 |
this.tags = tags; |
| 25 |
this.assets = assets; |
| 26 |
} |
| 27 |
|
| 28 |
public ImportAssets() { |
| 29 |
super(57, 5); |
| 30 |
} |
| 31 |
|
| 32 |
public SWFTag read(int tagID, SWFInputStream swf, int len) |
| 33 |
throws IOException { |
| 34 |
|
| 35 |
ImportAssets tag = new ImportAssets(); |
| 36 |
tag.url = swf.readString(); |
| 37 |
int n = swf.readUnsignedShort(); |
| 38 |
tag.tags = new int[n]; |
| 39 |
tag.assets = new String[n]; |
| 40 |
for (int i = 0; i < n; i++) { |
| 41 |
tag.tags[i] = swf.readUnsignedShort(); |
| 42 |
tag.assets[i] = swf.readString(); |
| 43 |
} |
| 44 |
return tag; |
| 45 |
} |
| 46 |
|
| 47 |
public void write(int tagID, SWFOutputStream swf) throws IOException { |
| 48 |
swf.writeString(url); |
| 49 |
swf.writeUnsignedShort(tags.length); |
| 50 |
for (int i = 0; i < tags.length; i++) { |
| 51 |
swf.writeUnsignedShort(tags[i]); |
| 52 |
swf.writeString(assets[i]); |
| 53 |
} |
| 54 |
} |
| 55 |
} |