1   // Copyright 2001, FreeHEP.
2   package org.freehep.graphicsio.swf.test;
3   
4   import java.io.FileInputStream;
5   import java.io.IOException;
6   
7   import org.freehep.graphicsio.swf.SWFHeader;
8   import org.freehep.graphicsio.swf.SWFInputStream;
9   import org.freehep.util.io.Tag;
10  
11  /**
12   * @author Mark Donszelmann
13   * @author Charles Loomis
14   * @version $Id: SWFDump.java 8584 2006-08-10 23:06:37Z duns $
15   */
16  public class SWFDump {
17  
18      public static void main(String[] args) {
19  
20          try {
21              if (args.length != 1) {
22                  System.err.println("Usage: SWFDump file.swf");
23                  System.exit(1);
24              }
25  
26              FileInputStream fis = new FileInputStream(args[0]);
27              SWFInputStream swf = new SWFInputStream(fis);
28  
29              long start = System.currentTimeMillis();
30              SWFHeader header = swf.readHeader();
31              System.out.println(header);
32  
33              Tag tag = swf.readTag();
34              while (tag != null) {
35                  System.out.println(tag);
36                  tag = swf.readTag();
37              }
38              // System.out.println(swf.getDictionary());
39              System.out.println("Parsed file in: "
40                      + (System.currentTimeMillis() - start) + " ms.");
41          } catch (IOException e) {
42              e.printStackTrace();
43          }
44  
45      }
46  
47  }