]> git.somenet.org - pub/jan/lsdc.git/blob - src/at/ac/tuwien/lsdc/util/CSVSchedulerLogger.java
arguments can now be entered directly from ant
[pub/jan/lsdc.git] / src / at / ac / tuwien / lsdc / util / CSVSchedulerLogger.java
1 package at.ac.tuwien.lsdc.util;
2
3 import java.io.FileWriter;
4 import java.io.IOException;
5 import java.util.List;
6
7 import at.ac.tuwien.lsdc.types.SchedulerData;
8 import au.com.bytecode.opencsv.CSVWriter;
9
10 public class CSVSchedulerLogger {
11
12         private final String filename;
13
14         public CSVSchedulerLogger(String filename) {
15                 this.filename = filename;
16         }
17
18         public void appendSchedulerData(SchedulerData data) {
19                 // check if filename exists
20                 // if not create file with header
21                 // append line data.toString()
22         }
23
24         public void writeFile(List data) throws IOException {
25                 CSVWriter writer = new CSVWriter(new FileWriter(filename), '\t');
26                 writer.writeAll(data);
27                 writer.close();
28         }
29
30         public void writeLine(String[] data) throws IOException {
31                 CSVWriter writer = new CSVWriter(new FileWriter(filename), '\t');
32                 writer.writeNext(data);
33                 writer.close();
34         }
35 }