List of usage examples for com.fasterxml.jackson.databind ObjectReader with
public ObjectReader with(ContextAttributes attrs)
From source file:com.couchbase.devex.CSVConfig.java
@Override public Observable<Document> startImport() { FileInputStream csvFile;/*from www .j a v a2 s. c om*/ try { csvFile = new FileInputStream(getCsvFilePath()); CsvMapper mapper = new CsvMapper(); mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY); CsvSchema csvSchema = CsvSchema.emptySchema().withColumnSeparator(getColumnSeparator()) .withQuoteChar(getQuoteChar()); ObjectReader reader = mapper.reader(String[].class); MappingIterator<String[]> it = reader.with(csvSchema).readValues(csvFile); if (!getSkipFirstLineForNames()) { String[] firstline = it.next(); updateColumnNames(firstline); } return Observable.from(new Iterable<String[]>() { @Override public Iterator<String[]> iterator() { return it; } }).flatMap(line -> createNode(line)); } catch (FileNotFoundException e) { return Observable.error(e); } catch (IOException e) { return Observable.error(e); } }