AirTravelLookup/src/DataReader.java

30 lines
684 B
Java
Raw Normal View History

2015-11-16 12:17:19 +00:00
import com.opencsv.CSVReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
public class DataReader {
2016-02-20 12:38:26 +00:00
static List<String[]> readCSVFile(final String fname) {
2015-11-16 12:17:19 +00:00
CSVReader reader = null;
List<String[]> entries = null;
try {
reader = new CSVReader(new FileReader(fname));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {
2016-02-20 12:38:26 +00:00
if (reader != null) {
entries = reader.readAll();
}
2015-11-16 12:17:19 +00:00
} catch (IOException e) {
e.printStackTrace();
}
return entries;
}
}