| 1 |
// Copyright 2003, FreeHEP. |
| 2 |
package org.freehep.graphicsio.emf.test; |
| 3 |
|
| 4 |
import hep.aida.IAnalysisFactory; |
| 5 |
import hep.aida.ITree; |
| 6 |
import hep.aida.ITuple; |
| 7 |
import hep.aida.ITupleFactory; |
| 8 |
|
| 9 |
import java.io.FileInputStream; |
| 10 |
import java.io.IOException; |
| 11 |
|
| 12 |
import org.freehep.graphicsio.emf.EMFHeader; |
| 13 |
import org.freehep.graphicsio.emf.EMFInputStream; |
| 14 |
import org.freehep.util.io.Tag; |
| 15 |
|
| 16 |
/** |
| 17 |
* @author Mark Donszelmann |
| 18 |
* @version $Id: freehep-graphicsio-emf/src/test/java/org/freehep/graphicsio/emf/test/EMFAnalyze.java f24bd43ca24b 2005/12/02 00:39:35 duns $ |
| 19 |
*/ |
| 20 |
public class EMFAnalyze { |
| 21 |
|
| 22 |
public static void main(String[] args) { |
| 23 |
|
| 24 |
try { |
| 25 |
IAnalysisFactory af = IAnalysisFactory.create(); |
| 26 |
ITree tree = af.createTreeFactory().create("EMFAnalyze.aida", |
| 27 |
"xml", false, true); |
| 28 |
ITupleFactory tf = af.createTupleFactory(tree); |
| 29 |
ITuple tuple = tf.create("EMF", "TagType", new String[] { "Tag", |
| 30 |
"TagSize" }, new Class[] { String.class, int.class }); |
| 31 |
|
| 32 |
FileInputStream fis = new FileInputStream(args[0]); |
| 33 |
EMFInputStream emf = new EMFInputStream(fis); |
| 34 |
|
| 35 |
long start = System.currentTimeMillis(); |
| 36 |
EMFHeader header = emf.readHeader(); |
| 37 |
System.out.println(header); |
| 38 |
|
| 39 |
Tag tag = emf.readTag(); |
| 40 |
while (tag != null) { |
| 41 |
// System.out.println(tag); |
| 42 |
tuple.fill(0, tag.getName()); |
| 43 |
tuple.addRow(); |
| 44 |
tag = emf.readTag(); |
| 45 |
// FIXME add tagSize |
| 46 |
} |
| 47 |
tree.commit(); |
| 48 |
System.out.println("Analyzed file in: " |
| 49 |
+ (System.currentTimeMillis() - start) + " ms."); |
| 50 |
} catch (IOException e) { |
| 51 |
e.printStackTrace(); |
| 52 |
} |
| 53 |
} |
| 54 |
} |