Java CSV File Load importCsv(File file)

Here you can find the source of importCsv(File file)

Description

import Csv

License

Apache License

Declaration

public static List<String> importCsv(File file) throws Exception 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.BufferedReader;

import java.io.File;

import java.io.FileReader;
import java.io.IOException;

import java.util.ArrayList;
import java.util.List;

public class Main {

    public static List<String> importCsv(File file) throws Exception {
        List<String> dataList = new ArrayList<String>();
        BufferedReader br = null;
        try {//from w w  w  .  ja  v  a  2s.co m
            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;
    }
}

Related

  1. importCsv(File file)
  2. importCsv(File file)