Search in sources :

Example 1 with DefaultCsvEncoder

use of org.supercsv.encoder.DefaultCsvEncoder in project openscoring by openscoring.

the class CsvUtil method createFormat.

private static CsvPreference createFormat(char delimiter, char quote) {
    CsvPreference.Builder builder = new CsvPreference.Builder(quote, delimiter, "\n");
    builder.useEncoder(new DefaultCsvEncoder());
    return builder.build();
}
Also used : CsvPreference(org.supercsv.prefs.CsvPreference) DefaultCsvEncoder(org.supercsv.encoder.DefaultCsvEncoder)

Example 2 with DefaultCsvEncoder

use of org.supercsv.encoder.DefaultCsvEncoder in project hive by apache.

the class SeparatedValuesOutputFormat method getCsvPreference.

private CsvPreference getCsvPreference() {
    char separator = this.defaultSeparator;
    char quoteChar = DEFAULT_QUOTE_CHAR;
    CsvEncoder encoder;
    if (DSV_OPT_OUTPUT_FORMAT.equals(beeLine.getOpts().getOutputFormat())) {
        separator = beeLine.getOpts().getDelimiterForDSV();
    }
    if (isQuotingDisabled()) {
        quoteChar = '\0';
        encoder = new SelectiveCsvEncoder();
    } else {
        encoder = new DefaultCsvEncoder();
    }
    return new CsvPreference.Builder(quoteChar, separator, StringUtils.EMPTY).useEncoder(encoder).build();
}
Also used : SelectiveCsvEncoder(org.supercsv.encoder.SelectiveCsvEncoder) DefaultCsvEncoder(org.supercsv.encoder.DefaultCsvEncoder) CsvEncoder(org.supercsv.encoder.CsvEncoder) DefaultCsvEncoder(org.supercsv.encoder.DefaultCsvEncoder) SelectiveCsvEncoder(org.supercsv.encoder.SelectiveCsvEncoder)

Aggregations

DefaultCsvEncoder (org.supercsv.encoder.DefaultCsvEncoder)2 CsvEncoder (org.supercsv.encoder.CsvEncoder)1 SelectiveCsvEncoder (org.supercsv.encoder.SelectiveCsvEncoder)1 CsvPreference (org.supercsv.prefs.CsvPreference)1