* Process the file and output to the target file.
* @param target The target file to write to.
*/
public final void process(final File target) {
try {
ReadCSV csv = new ReadCSV(this.getInputFilename().toString(),
this.isExpectInputHeaders(), this.getInputFormat());
PrintWriter tw = new PrintWriter(new FileWriter(target));
resetStatus();
while (csv.next() && !this.shouldStop()) {
StringBuilder line = new StringBuilder();
updateStatus(false);
line.append(this.getColumnData(FileData.DATE, csv));
line.append(" ");
line.append(this.getColumnData(FileData.TIME, csv));
line.append(";");
line.append(getInputFormat().format(
Double.parseDouble(this.getColumnData(FileData.OPEN,
csv)), this.getPrecision()));
line.append(";");
line.append(getInputFormat().format(
Double.parseDouble(this.getColumnData(FileData.HIGH,
csv)), this.getPrecision()));
line.append(";");
line.append(getInputFormat().format(
Double.parseDouble(this
.getColumnData(FileData.LOW, csv)),
this.getPrecision()));
line.append(";");
line.append(getInputFormat().format(
Double.parseDouble(this.getColumnData(FileData.CLOSE,
csv)), this.getPrecision()));
line.append(";");
line.append(getInputFormat().format(
Double.parseDouble(this.getColumnData(FileData.VOLUME,
csv)), this.getPrecision()));
tw.println(line.toString());
}
reportDone(false);
csv.close();
tw.close();
} catch (IOException ex) {
throw new QuantError(ex);
}
}