use of org.simpleflatmapper.param.CsvParam in project mapping-benchmark by arnaudroger.
the class UnivocityCsvParserBenchmark method main.
public static void main(String[] args) throws IOException {
CsvParam csvParam = new CsvParam();
csvParam.setUp();
CsvParserSettings settings = new CsvParserSettings();
// turning off features enabled by default
settings.setIgnoreLeadingWhitespaces(false);
settings.setIgnoreTrailingWhitespaces(false);
settings.setSkipEmptyLines(false);
settings.setColumnReorderingEnabled(false);
settings.setReadInputOnSeparateThread(false);
settings.setProcessor(new BeanProcessor<City>(City.class) {
@Override
public void beanProcessed(City bean, ParsingContext context) {
System.out.println(bean);
}
});
com.univocity.parsers.csv.CsvParser parser = new com.univocity.parsers.csv.CsvParser(settings);
try (Reader reader = csvParam.getReader()) {
parser.parse(reader);
}
}
use of org.simpleflatmapper.param.CsvParam in project mapping-benchmark by arnaudroger.
the class JacksonCsvParserBenchmark method main.
public static void main(String[] args) throws IOException {
CsvParam csvParam = new CsvParam();
csvParam.setUp();
CsvMapper csvMapper = new CsvMapper();
csvMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
CsvSchema bootstrapSchema = CsvSchema.emptySchema().withHeader();
try (Reader reader = csvParam.getReader()) {
MappingIterator<City> iterator = csvMapper.readerFor(City.class).with(bootstrapSchema).readValues(reader);
while (iterator.hasNext()) {
System.out.println(iterator.next());
}
}
}
Aggregations