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


Java CSVReader类代码示例

本文整理汇总了Java中liquibase.util.csv.CSVReader的典型用法代码示例。如果您正苦于以下问题:Java CSVReader类的具体用法?Java CSVReader怎么用?Java CSVReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: csvImport

import liquibase.util.csv.CSVReader; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private List<String[]> csvImport(String fileName){
	ClassLoader classLoader = getClass().getClassLoader();
	try {
		File file = new File(classLoader.getResource(fileName).getFile());
		CSVReader csvReader = new CSVReader(new FileReader(file), ',', '\"', 1);
		return csvReader.readAll();
	} catch (Exception e) {
		// drop
	}
	return null;
}
 
开发者ID:RBGKew,项目名称:powop,代码行数:13,代码来源:CsvResourceLoader.java

示例2: getCSVReader

import liquibase.util.csv.CSVReader; //导入依赖的package包/类
protected CSVReader getCSVReader() throws IOException {
    ResourceAccessor opener = getResourceAccessor();
    if (opener == null) {
        throw new UnexpectedLiquibaseException("No file opener specified for "+getFile());
    }
    InputStream stream = opener.getResourceAsStream(getFile());
    if (stream == null) {
        throw new UnexpectedLiquibaseException("Data file "+getFile()+" was not found");
    }

    InputStreamReader streamReader;
    if (getEncoding() == null) {
        streamReader = new InputStreamReader(stream);
    } else {
        streamReader = new InputStreamReader(stream, getEncoding());
    }

    char quotchar;
    if (0 == this.quotchar.length() ) {
    	// hope this is impossible to have a field surrounded with non ascii char 0x01
    	quotchar = '\1';
    } else {
    	quotchar = this.quotchar.charAt(0);
    }

    CSVReader reader = new CSVReader(streamReader, separator.charAt(0), quotchar );

    return reader;
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:30,代码来源:LoadDataChange.java

示例3: captureHeader

import liquibase.util.csv.CSVReader; //导入依赖的package包/类
public void captureHeader(CSVReader reader) throws IOException {
    //do nothing, first line is not header
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:4,代码来源:ColumnPositionMappingStrategy.java


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