KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > CDL > NBMain


1 /* $Id: NBMain.java,v 1.2 2004/05/20 14:23:51 bures Exp $ */
2 package SOFA.SOFAnode.Made.CDL;
3 import java.io.ByteArrayInputStream JavaDoc;
4 import java.io.File JavaDoc;
5 import java.io.FileInputStream JavaDoc;
6 import java.io.ObjectInputStream JavaDoc;
7
8 import SOFA.SOFAnode.Made.TIR.WorkRepository;
9
10 /** class for launching external compiler from NB */
11 public class NBMain {
12   public static void main(String JavaDoc[] argv) {
13     try {
14       Output.setOut(new ConsoleLogger());
15       System.setSecurityManager(new java.rmi.RMISecurityManager JavaDoc());
16
17       String JavaDoc reference = argv[0];
18       byte[] bArr = new byte [reference.length() / 2];
19       for(int i=0;i<reference.length();i+=2) {
20         StringBuffer JavaDoc a = new StringBuffer JavaDoc();
21         a.append(reference.charAt(i));
22         a.append(reference.charAt(i+1));
23         bArr[i/2] = (byte) (Integer.parseInt(a.toString() ,16) - 128);
24       }
25       ObjectInputStream JavaDoc ostr = new ObjectInputStream JavaDoc(new ByteArrayInputStream JavaDoc(bArr));
26       Object JavaDoc obj = ostr.readObject();
27       ostr.close();
28       bArr = null;
29
30       WorkRepository wRep = (WorkRepository) obj;
31
32       Output.out.println(wRep.workIdent());
33       
34       File JavaDoc fname = new File JavaDoc(argv[1]);
35       parser.doParse(new FileInputStream JavaDoc(fname),fname.getName(), null , wRep, false, false );
36
37     } catch (Exception JavaDoc e) {
38       Output.out.println("Exception: "+e.getMessage());
39       e.printStackTrace();
40       System.exit(1);
41     }
42  
43   }
44 }
45
Popular Tags