use of org.supercsv.prefs.CsvPreference in project openscoring by openscoring.
the class CsvUtil method getFormat.
public static CsvPreference getFormat(String delimiterChar, String quoteChar) {
char delimiter = ',';
char quote = '\"';
if (delimiterChar != null) {
delimiterChar = decodeDelimiter(delimiterChar);
if (delimiterChar.length() != 1) {
throw new IllegalArgumentException("Invalid CSV delimiter character: \"" + delimiterChar + "\"");
}
delimiter = delimiterChar.charAt(0);
}
if (quoteChar != null) {
quoteChar = decodeQuote(quoteChar);
if (quoteChar.length() != 1) {
throw new IllegalArgumentException("Invalid CSV quote character: \"" + quoteChar + "\"");
}
quote = quoteChar.charAt(0);
}
CsvPreference format = createFormat(delimiter, quote);
return format;
}
Aggregations