add source code that does not have location annotations.
[IRC.git] / Robust / src / Benchmarks / SSJava / MP3DecoderInfer / DataParse.java
1 import java.io.*;
2 import java.util.*;
3
4 public class DataParse {
5
6   public static void main(String args[]) {
7
8     try {
9
10       FileWriter fout = new FileWriter("out.csv");
11       BufferedWriter out = new BufferedWriter(fout);
12
13       FileInputStream fin = new FileInputStream("errinj-history-5001.txt");
14       DataInputStream in = new DataInputStream(fin);
15       BufferedReader br = new BufferedReader(new InputStreamReader(in));
16       String inLine;
17       String value;
18       while ((inLine = br.readLine()) != null) {
19         // System.out.println(inLine);
20         if (inLine.startsWith("idx")) {
21           value = inLine.substring(4, inLine.length());
22           out.write("\n" + value);
23         } else if (inLine.startsWith("inj")) {
24           if (inLine.length() > 3) {
25             value = inLine.substring(4, inLine.length());
26             if (value.length() > 0) {
27               StringTokenizer st = new StringTokenizer(value, " ");
28               if (st.hasMoreTokens()) {
29                 out.write("," + st.nextToken());
30               }
31             }
32           }
33         } else if (inLine.startsWith("NO DIFF")) {
34           // do nothing
35         } else {
36           out.write("," + inLine);
37         }
38       }
39       in.close();
40       out.close();
41
42     } catch (Exception e) {
43       System.out.println(e);
44     }
45
46   }
47
48 }