本文整理汇总了Java中au.com.bytecode.opencsv.CSVParser.NULL_CHARACTER属性的典型用法代码示例。如果您正苦于以下问题:Java CSVParser.NULL_CHARACTER属性的具体用法?Java CSVParser.NULL_CHARACTER怎么用?Java CSVParser.NULL_CHARACTER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类au.com.bytecode.opencsv.CSVParser
的用法示例。
在下文中一共展示了CSVParser.NULL_CHARACTER属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
public void parse(Reader fileReader, String fileType, LogRecordCollector collector) throws IOException {
try (CSVReader csvReader = new CSVReader(
fileReader,
config.getDelimiter(),
CSVParser.DEFAULT_QUOTE_CHARACTER,
CSVParser.NULL_CHARACTER);) {
long line = 0;
String[] headers = csvReader.readNext();
line++;
String[] fieldNames = constructFieldNames(headers, fileType, config.isCleanKeysForES());
String[] record = null;
while ((record = csvReader.readNext()) != null) {
if (record.length != headers.length) {
// unmatched record length
LOGGER.warn("Unmatched record column count detected at line {} - header: {} record: {}",
line, headers.length, record.length);
continue;
}
LogRecord logRecord = new LogRecord();
for (int i = 0; i < fieldNames.length; i++) {
if (config.isSkipBlankFields() && StringUtils.isBlank(record[i])) {
// skip
} else {
String value = config.isTrimFieldValue() ? StringUtils.trim(record[i]) : record[i];
logRecord.setValue(fieldNames[i], value);
}
}
collector.emit(logRecord);
}
}
}
示例2: CSVRDFReader
public CSVRDFReader(InputStream ins, PrefixMapping prefixes) {
reader = new CSVReader(
new InputStreamReader(ins, StandardCharsets.UTF_8),
',', '"', CSVParser.NULL_CHARACTER );
this.prefixes = prefixes;
try {
headers = reader.readNext();
for (int i = 0; i < headers.length; i++) {
headerIndex.put(headers[i], i);
}
} catch (IOException e) {
throw new EpiException("Problem reading CSV", e);
}
}
示例3: newReader
public static CSVReader newReader(Reader reader) {
return new CSVReader(reader, CSVWriter.DEFAULT_SEPARATOR, CSVWriter.DEFAULT_QUOTE_CHARACTER,
CSVParser.NULL_CHARACTER);
}