DelimiterWriterFactory factory = new DelimiterWriterFactory(delimiter, textQualifier);
// add columns from the keys in the data map as the columns must be known
for (String key : firstRow.keySet()) {
factory.addColumnTitle(key);
}
return factory.createWriter(new OutputStreamWriter(stream, IOHelper.getCharsetName(exchange)));
} else {
InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(exchange.getContext().getClassResolver(), getDefinition());
InputStreamReader reader = new InputStreamReader(is, IOHelper.getCharsetName(exchange));
DelimiterWriterFactory factory = new DelimiterWriterFactory(reader, delimiter, textQualifier);
return factory.createWriter(new OutputStreamWriter(stream, IOHelper.getCharsetName(exchange)));