一、下载地址:https://sourceforge.net/projects/javacsv/
读取示例:
public static void main(String[] args) {
// 1.声明CsvReader类用于csv文件读取
CsvReader nCsvReader = null;
try {
// 2.实例化CsvReader类用于csv文件读取
nCsvReader = new CsvReader("C:\\Users\\Administrator\\Desktop\\scv\\zfile0.csv");
// 3.循环reader的结果集
while (nCsvReader.readRecord()) {
for (int i = 0; i < nCsvReader.getColumnCount(); i++) {
String aa=nCsvReader.get(i);
byte[] bytes=aa.getBytes("ISO8859-1");
String s=new String(bytes,"gbk");
System.out.println(s);
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
// 关闭读取连接
nCsvReader.close();
}
}