예제 #1
0
 /**
  * Outputs the report table in CSV format.
  *
  * @param report the report
  * @param out the output stream to write to
  */
 @SuppressWarnings("resource")
 public void writeCsv(R report, OutputStream out) {
   OutputStreamWriter outputWriter = new OutputStreamWriter(out);
   CsvOutput csvOut = new CsvOutput(outputWriter);
   csvOut.writeLine(Arrays.asList(report.getColumnHeaders()));
   IntStream.range(0, report.getRowCount())
       .mapToObj(rowIdx -> Arrays.asList(formatRow(report, rowIdx, ReportOutputFormat.CSV)))
       .forEachOrdered(csvOut::writeLine);
   Unchecked.wrap(() -> outputWriter.flush());
 }
예제 #2
0
 /**
  * Outputs the report table in CSV format.
  *
  * @param report the report
  * @param out the output stream to write to
  */
 @SuppressWarnings("resource")
 public void writeCsv(R report, OutputStream out) {
   OutputStreamWriter outputWriter = new OutputStreamWriter(out, StandardCharsets.UTF_8);
   CsvOutput csvOut = new CsvOutput(outputWriter);
   csvOut.writeLine(report.getColumnHeaders());
   IntStream.range(0, report.getRowCount())
       .mapToObj(rowIdx -> formatRow(report, rowIdx, ReportOutputFormat.CSV))
       .forEach(csvOut::writeLine);
   Unchecked.wrap(outputWriter::flush);
 }