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


Java CsvMapper.configure方法代码示例

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


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

示例1: testRunSorterFirstColumn

import com.fasterxml.jackson.dataformat.csv.CsvMapper; //导入方法依赖的package包/类
@Test
public final void testRunSorterFirstColumn() throws Exception {
	CsvFactory csvFactory = new CsvFactory();
	csvFactory.enable(CsvParser.Feature.TRIM_SPACES);
	// csvFactory.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	csvFactory.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	CsvMapper mapper = new CsvMapper(csvFactory);
	mapper.enable(CsvParser.Feature.TRIM_SPACES);
	// mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	mapper.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	// mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
	// true);
	
	CsvSchema schema = CsvSchema.builder().setUseHeader(false).build();
	verifyCSV(testInput1, 1, 2, 4, mapper, schema);

	try (Reader inputReader = Files.newBufferedReader(testInput1, StandardCharsets.UTF_8)) {
		CSVSorter.runSorter(inputReader, testOutput, 1, schema, CSVSorter.getComparator(0), true);
	}

	verifyCSV(testOutput, 1, 2, 4, mapper, schema);
}
 
开发者ID:ansell,项目名称:csvsum,代码行数:23,代码来源:CSVSorterTest.java

示例2: testRunSorterSecondColumn

import com.fasterxml.jackson.dataformat.csv.CsvMapper; //导入方法依赖的package包/类
@Test
public final void testRunSorterSecondColumn() throws Exception {
	CsvFactory csvFactory = new CsvFactory();
	csvFactory.enable(CsvParser.Feature.TRIM_SPACES);
	// csvFactory.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	csvFactory.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	CsvMapper mapper = new CsvMapper(csvFactory);
	mapper.enable(CsvParser.Feature.TRIM_SPACES);
	// mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	mapper.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	// mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
	// true);
	
	CsvSchema schema = CsvSchema.builder().setUseHeader(false).build();
	verifyCSV(testInput1, 1, 2, 4, mapper, schema);
	try (Reader inputReader = Files.newBufferedReader(testInput1, StandardCharsets.UTF_8)) {
		CSVSorter.runSorter(inputReader, testOutput, 1, schema, CSVSorter.getComparator(1), true);
	}

	verifyCSV(testOutput, 1, 2, 4, mapper, schema);
}
 
开发者ID:ansell,项目名称:csvsum,代码行数:22,代码来源:CSVSorterTest.java

示例3: testRunSorterSecondColumnThenFirst

import com.fasterxml.jackson.dataformat.csv.CsvMapper; //导入方法依赖的package包/类
@Test
public final void testRunSorterSecondColumnThenFirst() throws Exception {
	CsvFactory csvFactory = new CsvFactory();
	csvFactory.enable(CsvParser.Feature.TRIM_SPACES);
	// csvFactory.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	csvFactory.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	CsvMapper mapper = new CsvMapper(csvFactory);
	mapper.enable(CsvParser.Feature.TRIM_SPACES);
	// mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	mapper.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	// mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
	// true);

	CsvSchema schema = CsvSchema.builder().setUseHeader(false).build();
	verifyCSV(testInput3, 1, 2, 5, mapper, schema);

	try (Reader inputReader = Files.newBufferedReader(testInput3, StandardCharsets.UTF_8)) {
		CSVSorter.runSorter(inputReader, testOutput, 1, schema, CSVSorter.getComparator(1, 0), true);
	}

	verifyCSV(testOutput, 1, 2, 5, mapper, schema);
}
 
开发者ID:ansell,项目名称:csvsum,代码行数:23,代码来源:CSVSorterTest.java

示例4: testRunSorterFirstColumnThenSecond

import com.fasterxml.jackson.dataformat.csv.CsvMapper; //导入方法依赖的package包/类
@Test
public final void testRunSorterFirstColumnThenSecond() throws Exception {
	CsvFactory csvFactory = new CsvFactory();
	csvFactory.enable(CsvParser.Feature.TRIM_SPACES);
	// csvFactory.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	csvFactory.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	CsvMapper mapper = new CsvMapper(csvFactory);
	mapper.enable(CsvParser.Feature.TRIM_SPACES);
	// mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	mapper.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	// mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
	// true);
	
	CsvSchema schema = CsvSchema.builder().setUseHeader(false).build();
	verifyCSV(testInput3, 1, 2, 5, mapper, schema);

	try (Reader inputReader = Files.newBufferedReader(testInput3, StandardCharsets.UTF_8)) {
		CSVSorter.runSorter(inputReader, testOutput, 1, schema, CSVSorter.getComparator(0, 1), true);
	}

	verifyCSV(testOutput, 1, 2, 5, mapper, schema);
}
 
开发者ID:ansell,项目名称:csvsum,代码行数:23,代码来源:CSVSorterTest.java

示例5: testRunSorterTSV

import com.fasterxml.jackson.dataformat.csv.CsvMapper; //导入方法依赖的package包/类
@Test
public final void testRunSorterTSV() throws Exception {
	CsvFactory csvFactory = new CsvFactory();
	csvFactory.enable(CsvParser.Feature.TRIM_SPACES);
	// csvFactory.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	csvFactory.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	CsvMapper mapper = new CsvMapper(csvFactory);
	mapper.enable(CsvParser.Feature.TRIM_SPACES);
	// mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	mapper.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	// mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
	// true);
	CsvSchema schema = CsvSchema.builder().setUseHeader(false).setColumnSeparator('\t').build();
	verifyCSV(testInput4, 1, 2, 5, mapper, schema);

	try (Reader inputReader = Files.newBufferedReader(testInput4, StandardCharsets.UTF_8)) {
		CSVSorter.runSorter(inputReader, testOutput, 1, schema, CSVSorter.getComparator(0, 1), true);
	}

	verifyCSV(testOutput, 1, 2, 5, mapper, schema);
}
 
开发者ID:ansell,项目名称:csvsum,代码行数:22,代码来源:CSVSorterTest.java

示例6: testRunSorterTSVMultipleHeaderLines

import com.fasterxml.jackson.dataformat.csv.CsvMapper; //导入方法依赖的package包/类
@Test
public final void testRunSorterTSVMultipleHeaderLines() throws Exception {
	CsvFactory csvFactory = new CsvFactory();
	csvFactory.enable(CsvParser.Feature.TRIM_SPACES);
	// csvFactory.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	csvFactory.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	CsvMapper mapper = new CsvMapper(csvFactory);
	mapper.enable(CsvParser.Feature.TRIM_SPACES);
	// mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	mapper.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	// mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
	// true);
	CsvSchema schema = CsvSchema.builder().setUseHeader(false).setColumnSeparator('\t').build();
	verifyCSV(testInput5, 10, 2, 5, mapper, schema);

	try (Reader inputReader = Files.newBufferedReader(testInput5, StandardCharsets.UTF_8)) {
		CSVSorter.runSorter(inputReader, testOutput, 10, schema, CSVSorter.getComparator(0, 1), true);
	}

	verifyCSV(testOutput, 10, 2, 5, mapper, schema);
}
 
开发者ID:ansell,项目名称:csvsum,代码行数:22,代码来源:CSVSorterTest.java

示例7: main

import com.fasterxml.jackson.dataformat.csv.CsvMapper; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    CsvParam csvParam = new CsvParam();
    csvParam.setUp();

    CsvMapper csvMapper = new CsvMapper();

    csvMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);

    CsvSchema bootstrapSchema = CsvSchema.emptySchema().withHeader();

    try(Reader reader = csvParam.getReader()) {
        MappingIterator<City> iterator = csvMapper.readerFor(City.class).with(bootstrapSchema).readValues(reader);

        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}
 
开发者ID:arnaudroger,项目名称:mapping-benchmark,代码行数:19,代码来源:JacksonCsvParserBenchmark.java

示例8: getSafeSortingMapper

import com.fasterxml.jackson.dataformat.csv.CsvMapper; //导入方法依赖的package包/类
public static CsvMapper getSafeSortingMapper() {
	CsvFactory csvFactory = new CsvFactory();
	csvFactory.enable(CsvParser.Feature.TRIM_SPACES);
	csvFactory.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	csvFactory.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	CsvMapper mapper = new CsvMapper(csvFactory);
	mapper.enable(CsvParser.Feature.TRIM_SPACES);
	mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY);
	mapper.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
	// mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
	// true);
	return mapper;
}
 
开发者ID:ansell,项目名称:csvsum,代码行数:14,代码来源:CSVSorter.java

示例9: setUp

import com.fasterxml.jackson.dataformat.csv.CsvMapper; //导入方法依赖的package包/类
@Setup
public void setUp() {
    csvMapperToStringArray = new CsvMapper();
    csvMapperToStringArray.enable(com.fasterxml.jackson.dataformat.csv.CsvParser.Feature.WRAP_AS_ARRAY);

    CsvMapper csvMapperToCity = new CsvMapper();


    csvMapperToCity.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);

    CsvSchema bootstrapSchema = CsvSchema.emptySchema().withHeader();

    cityReader = csvMapperToCity.readerFor(City.class).with(bootstrapSchema);

}
 
开发者ID:arnaudroger,项目名称:mapping-benchmark,代码行数:16,代码来源:JacksonCsvParserBenchmark.java


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