View Javadoc

1   // Copyright 2001, FreeHEP.
2   package org.freehep.graphicsio.swf;
3   
4   import java.io.IOException;
5   
6   /**
7    * ExportAssets TAG.
8    * 
9    * @author Mark Donszelmann
10   * @author Charles Loomis
11   * @version $Id: ExportAssets.java 8584 2006-08-10 23:06:37Z duns $
12   */
13  public class ExportAssets extends ControlTag {
14  
15      private int[] tags;
16  
17      private String[] assets;
18  
19      public ExportAssets(int[] tags, String[] assets) {
20          this();
21          this.tags = tags;
22          this.assets = assets;
23      }
24  
25      public ExportAssets() {
26          super(56, 5);
27      }
28  
29      public SWFTag read(int tagID, SWFInputStream swf, int len)
30              throws IOException {
31  
32          ExportAssets tag = new ExportAssets();
33          int n = swf.readUnsignedShort();
34          tag.tags = new int[n];
35          tag.assets = new String[n];
36          for (int i = 0; i < n; i++) {
37              tag.tags[i] = swf.readUnsignedShort();
38              tag.assets[i] = swf.readString();
39          }
40          return tag;
41      }
42  
43      public void write(int tagID, SWFOutputStream swf) throws IOException {
44          swf.writeUnsignedShort(tags.length);
45          for (int i = 0; i < tags.length; i++) {
46              swf.writeUnsignedShort(tags[i]);
47              swf.writeString(assets[i]);
48          }
49      }
50  }