How to Ignore empty lines? I am using the below snippet of code and it doesnt ignore the empty lines. Any pointer configuration available in CSV parser to fix this issue?
public CSVParser parseCSV(InputStream inputStream) {
try {
return new CSVParser(new InputStreamReader(inputStream, StandardCharsets.UTF_8), CSVFormat.DEFAULT
.withFirstRecordAsHeader()
.withIgnoreHeaderCase()
.withSkipHeaderRecord()
.withIgnoreEmptyLines()
.withTrim());
} catch (IOException e) {
throw new IPRSException(e);
}
}
Sample file
h1,h2,h3
d1,d2,d3
,,,
Expected output
d1,d2,d3
,,,an empty line or a non-empty line with no values?