Java Utililty Methods CSV File Load

List of utility methods to do CSV File Load

  1. HOME
  2. Java
  3. C
  4. CSV File Load

Description

The list of methods to do CSV File Load are organized into topic(s).

Method

List> importCsv(File file)
Imports a CSV file.
List<List<String>> rows = new ArrayList<List<String>>();
try (BufferedReader br = new BufferedReader(new FileReader(file))) {
 String line;
 while ((line = br.readLine()) != null) {
 rows.add(Arrays.asList(line.split(",")));
return rows;
...
List importCsv(File file)
import Csv
List<String> dataList = new ArrayList<String>();
BufferedReader br = null;
try {
 br = new BufferedReader(new FileReader(file));
 String line = "";
 while ((line = br.readLine()) != null) {
 dataList.add(line);
} catch (Exception e) {
 throw e;
} finally {
 if (br != null) {
 try {
 br.close();
 br = null;
 } catch (IOException e) {
 e.printStackTrace();
return dataList;
String[][] importCsv(File file)
Convert the csv into an array of String[].
if (!file.exists())
 throw new FileNotFoundException(file.getAbsolutePath());
return importCsv(new FileReader(file));

AltStyle によって変換されたページ (->オリジナル) /