package org.josast.AmsatList.source;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.opencsv.*;
import com.opencsv.CSVParserBuilder;
import com.opencsv.CSVReader;
import com.opencsv.CSVReaderBuilder;


public class ReadCsvFile {
	


	public List<String[]> allLine(String file) {
	    List<String[]> list = new ArrayList<>();
	    FileReader fileReader = null;
		try {
			fileReader = new FileReader(file);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		   CSVParser parser = new CSVParserBuilder().withSeparator(';').build();
		   CSVReader csvReader = new CSVReaderBuilder(fileReader).withCSVParser(parser).build();
		
	   // CSVReader csvReader = new CSVReader(fileReader,';');
	    String[] line;
	    try {
			while ((line = csvReader.readNext()) != null) {
			    list.add(line);

			}
		    
		    fileReader.close();
		    csvReader.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	    return list;
	}
	
}
