当前位置: 首页>>代码示例>>Java>>正文


Java CsvParserSettings.setEmptyValue方法代码示例

本文整理汇总了Java中com.univocity.parsers.csv.CsvParserSettings.setEmptyValue方法的典型用法代码示例。如果您正苦于以下问题:Java CsvParserSettings.setEmptyValue方法的具体用法?Java CsvParserSettings.setEmptyValue怎么用?Java CsvParserSettings.setEmptyValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.univocity.parsers.csv.CsvParserSettings的用法示例。


在下文中一共展示了CsvParserSettings.setEmptyValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSettings

import com.univocity.parsers.csv.CsvParserSettings; //导入方法依赖的package包/类
/**
 * Creates the CsvParserSettings.
 *
 * @param delimiter the delimiter
 * @param quote the quote
 * @param escape the escape
 * @param linebreak the linebreak
 * @return the csv parser settings
 */
private CsvParserSettings createSettings(final char delimiter, final char quote, final char escape, final char[] linebreak) {
    CsvFormat format = new CsvFormat();
    format.setDelimiter(delimiter);
    format.setQuote(quote);
    format.setQuoteEscape(escape);
    format.setLineSeparator(linebreak);
    format.setNormalizedNewline(CSVSyntax.getNormalizedLinebreak(linebreak));
    format.setComment('\0');

    CsvParserSettings settings = new CsvParserSettings();
    settings.setEmptyValue("");
    settings.setNullValue("");
    settings.setFormat(format);
    return settings;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:25,代码来源:CSVDataInput.java

示例2: prepareParserSettings

import com.univocity.parsers.csv.CsvParserSettings; //导入方法依赖的package包/类
static CsvParserSettings prepareParserSettings(RowProcessor rowProcessor) {
	final CsvParserSettings settings = new CsvParserSettings();
	settings.setInputBufferSize(16 * 1024);
	settings.setReadInputOnSeparateThread(false);
	settings.setCommentCollectionEnabled(false);
	settings.setEmptyValue("");
	settings.setNullValue(null);
	settings.setNumberOfRowsToSkip(1);
	settings.setSkipEmptyLines(false);
	settings.setProcessor(rowProcessor);
	return settings;
}
 
开发者ID:axibase,项目名称:atsd-jdbc,代码行数:13,代码来源:RowIterator.java

示例3: configureParserSettings

import com.univocity.parsers.csv.CsvParserSettings; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void configureParserSettings(CsvParserSettings settings) {
    super.configureParserSettings(settings);

    if (emptyValue != null) {
        settings.setEmptyValue(emptyValue);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:UniVocityCsvDataFormat.java

示例4: readRecordsFromTestFile

import com.univocity.parsers.csv.CsvParserSettings; //导入方法依赖的package包/类
/**
 * Return a List<String[]> of the parsed file.
 * The first item in the list <code>list.get(0)</code> is a <code>String[]<code/> of headers. The rest
 * of the elements are rows in the file
 *
 * @param pathToFile Full path in File System to a CSV file that contains records
 * @return List<String[]> where the first record is the field names and the rest are the records
 */
public static List<String[]> readRecordsFromTestFile(String pathToFile) {
    // The settings object provides many configuration options
    CsvParserSettings parserSettings = new CsvParserSettings();

    //You can configure the parser to automatically detect what line separator sequence is in the input
    parserSettings.setLineSeparatorDetectionEnabled(true);

    // A RowListProcessor stores each parsed row in a List.
    RowListProcessor rowProcessor = new RowListProcessor();

    // You can configure the parser to use a RowProcessor to process the values of each parsed row.
    // You will find more RowProcessors in the 'com.univocity.parsers.common.processor' package, but you can also create your own.
    parserSettings.setRowProcessor(rowProcessor);

    parserSettings.setEmptyValue(StringUtils.EMPTY);
    parserSettings.setNullValue(StringUtils.EMPTY);

    // Let's consider the first parsed row as the headers of each column in the file.
    parserSettings.setHeaderExtractionEnabled(true);

    DatasetParser datasetParser = new DatasetParser();
    datasetParser.getParserForFile(pathToFile, parserSettings);

    // get the parsed records from the RowListProcessor here.
    // Note that different implementations of RowProcessor will provide different sets of functionalities.
    String[] headers = rowProcessor.getHeaders();
    List<String[]> rows = rowProcessor.getRows();
    List<String[]> results = new ArrayList<>();
    results.add(headers);
    results.addAll(rows);
    return results;
}
 
开发者ID:sapirgolan,项目名称:MFIBlocking,代码行数:41,代码来源:UtilitiesForBlocksAndRecords.java


注:本文中的com.univocity.parsers.csv.CsvParserSettings.setEmptyValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。