I am using apache-common-csv to import data from the CSV file and I would like to skip headers in the first line. What is important, the file sometimes can contain headers but sometimes not. I have an implementation like below but the result not satisfying me, because when the file is without headers the first line is cutting.
CSVFormat.DEFAULT
.withDelimiter(';')
.withHeader(HEADERS)
.withSkipHeaderRecord()
.parse(InputStreamReadersource.inputStream)