/** * Write a row to the destination. * * @param row The row to write. * @throws java.io.IOException Exception thrown when there's problems * writing to the output. */ @Override protected void writeToOutput(final Map<String, Object> row) throws IOException { if (writer == null) { CsvMapper mapper = new CsvMapper(); mapper.disable(SerializationFeature.CLOSE_CLOSEABLE); mapper.getFactory() .configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false); CsvSchema schema = buildCsvSchema(row); writer = mapper.writer(schema); writer.writeValue(getWriter(), row.keySet()); } writer.writeValue(getWriter(), row.values()); }