dev.spiti.utility.datareader.readers.CSV Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of data-reader Show documentation
Show all versions of data-reader Show documentation
A utility to read test data from excel and csv and write data as needed
The newest version!
package dev.spiti.utility.datareader.readers;
import com.opencsv.CSVReader;
import java.io.FileReader;
import java.util.*;
import java.util.stream.Collectors;
public class CSV extends BaseReader {
private static CSVReader READER;
private static final String EXTENSION = ".csv";
public CSV() {
}
public CSV(String file) {
this.READER = readFile(file);
}
public CSVReader readFile(String file) {
CSVReader reader = null;
try{
reader = new CSVReader(new FileReader(getPath() + file + EXTENSION));
} catch (Exception e) {
LOGGER.error("Error is reading CSV file " + e.getMessage());
e.printStackTrace();
}
return reader;
}
private List