java.io.BufferedReader.readLine() でCSVファイルを読み込む方法
Javaコード
package itstudy;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
public class CsvReadDemo {
public static void main(String[] args) {
try {
File cnt = new File(“C:\\study\\test.csv");
InputStreamReader zd = new InputStreamReader(new FileInputStream(cnt), “Windows-31J");
BufferedReader breader = new BufferedReader(zd);
String dataLine = “";
while ((dataLine = breader.readLine()) != null) {
String[] ttArr = dataLine.split(“,", 0);
for (String k : ttArr) {
System.out.println(k);
}
}
breader.close();
} catch (IOException e) {
System.out.println(e);
}
}
}