Search in sources :

Example 1 with CsvBeanReader

use of org.supercsv.io.CsvBeanReader in project apex-malhar by apache.

the class CsvParser method setup.

@Override
public void setup(OperatorContext context) {
    delimitedParserSchema = new DelimitedSchema(schema);
    preference = new CsvPreference.Builder(delimitedParserSchema.getQuoteChar(), delimitedParserSchema.getDelimiterChar(), delimitedParserSchema.getLineDelimiter()).build();
    nameMapping = delimitedParserSchema.getFieldNames().toArray(new String[delimitedParserSchema.getFieldNames().size()]);
    header = StringUtils.join(nameMapping, (char) delimitedParserSchema.getDelimiterChar() + "");
    processors = getProcessor(delimitedParserSchema.getFields());
    csvStringReader = new ReusableStringReader();
    csvMapReader = new CsvMapReader(csvStringReader, preference);
    csvBeanReader = new CsvBeanReader(csvStringReader, preference);
}
Also used : ReusableStringReader(org.apache.apex.malhar.lib.util.ReusableStringReader) CsvBeanReader(org.supercsv.io.CsvBeanReader) CsvMapReader(org.supercsv.io.CsvMapReader)

Aggregations

ReusableStringReader (org.apache.apex.malhar.lib.util.ReusableStringReader)1 CsvBeanReader (org.supercsv.io.CsvBeanReader)1 CsvMapReader (org.supercsv.io.CsvMapReader)1