Source:
public PageOutput open(TaskSource taskSource, final Schema schema, FileOutput output) { final PluginTask task = taskSource.loadTask(PluginTask.class); final LineEncoder encoder = new LineEncoder(output, task); final Map<Integer, TimestampFormatter> timestampFormatters = newTimestampFormatters(task, schema); encoder.nextFile(); if (task.getHeaderLine()) { writeHeader(schema, encoder); } return new PageOutput() { private final PageReader pageReader = new PageReader(schema); public void add(Page page) { pageReader.setPage(page); while (pageReader.nextRecord()) { schema.visitColumns(new ColumnVisitor() { public void booleanColumn(Column column) { addDelimiter(column); if (!pageReader.isNull(column)) { encoder.addText(Boolean.toString(pageReader.getBoolean(column))); } } public void longColumn(Column column) { addDelimiter(column); if (!pageReader.isNull(column)) { encoder.addText(Long.toString(pageReader.getLong(column))); } } public void doubleColumn(Column column) { addDelimiter(column); if (!pageReader.isNull(column)) { encoder.addText(Double.toString(pageReader.getDouble(column))); } } public void stringColumn(Column column) { addDelimiter(column); if (!pageReader.isNull(column)) { encoder.addText(pageReader.getString(column)); } } public void timestampColumn(Column column) { addDelimiter(column); if (!pageReader.isNull(column)) { Timestamp value = pageReader.getTimestamp(column); encoder.addText(timestampFormatters.get(column.getIndex()).format(value)); } } private void addDelimiter(Column column) { if (column.getIndex() != 0) { encoder.addText(task.getDelimiterChar()); } } }); encoder.addNewLine(); } } public void finish() { encoder.finish(); } public void close() { encoder.close(); } }; }

Target:
public PageOutput open(TaskSource taskSource, final Schema schema, FileOutput output) { final PluginTask task = taskSource.loadTask(PluginTask.class); final LineEncoder encoder = new LineEncoder(output, task); final Map<Integer, TimestampFormatter> timestampFormatters = newTimestampFormatters(task, schema); final String delimiter = task.getDelimiterChar(); encoder.nextFile(); if (task.getHeaderLine()) { writeHeader(schema, encoder, delimiter); } return new PageOutput() { private final PageReader pageReader = new PageReader(schema); public void add(Page page) { pageReader.setPage(page); while (pageReader.nextRecord()) { schema.visitColumns(new ColumnVisitor() { public void booleanColumn(Column column) { addDelimiter(column); if (!pageReader.isNull(column)) { encoder.addText(Boolean.toString(pageReader.getBoolean(column))); } } public void longColumn(Column column) { addDelimiter(column); if (!pageReader.isNull(column)) { encoder.addText(Long.toString(pageReader.getLong(column))); } } public void doubleColumn(Column column) { addDelimiter(column); if (!pageReader.isNull(column)) { encoder.addText(Double.toString(pageReader.getDouble(column))); } } public void stringColumn(Column column) { addDelimiter(column); if (!pageReader.isNull(column)) { encoder.addText(pageReader.getString(column)); } } public void timestampColumn(Column column) { addDelimiter(column); if (!pageReader.isNull(column)) { Timestamp value = pageReader.getTimestamp(column); encoder.addText(timestampFormatters.get(column.getIndex()).format(value)); } } private void addDelimiter(Column column) { if (column.getIndex() != 0) { encoder.addText(delimiter); } } }); encoder.addNewLine(); } } public void finish() { encoder.finish(); } public void close() { encoder.close(); } }; }