本文整理汇总了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;
}
示例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;
}
示例3: captureHeader
import liquibase.util.csv.CSVReader; //导入依赖的package包/类
public void captureHeader(CSVReader reader) throws IOException {
//do nothing, first line is not header
}