Example usage for com.fasterxml.jackson.dataformat.csv CsvSchema emptySchema

List of usage examples for com.fasterxml.jackson.dataformat.csv CsvSchema emptySchema

Introduction

In this page you can find the example usage for com.fasterxml.jackson.dataformat.csv CsvSchema emptySchema.

Prototype

public static CsvSchema emptySchema() 

Source Link

Document

Accessor for creating a "default" CSV schema instance, with following settings:
  • Does NOT use header line
  • Uses double quotes ('"') for quoting of field values (if necessary)
  • Uses comma (',') as the field separator
  • Uses Unix linefeed ('\n') as row separator
  • Does NOT use any escape characters
  • Does NOT have any columns defined

Usage

From source file:org.wso2.developerstudio.datamapper.diagram.schemagen.util.SchemaGeneratorForCSV.java

/**
 * Read objects from CSV/*from  www.  ja v  a2 s .c  o  m*/
 * 
 * @param content
 * @return
 * @throws IOException
 */
public List<Map<String, String>> readObjectsFromCsv(String content) throws IOException {
    CsvMapper mapper = new CsvMapper();
    CsvSchema schema = CsvSchema.emptySchema().withHeader();
    MappingIterator<Map<String, String>> it = mapper.readerFor(Map.class).with(schema).readValues(content);
    return it.readAll();
}