You notice this line in the samples you are referencing:
final String[] header = inFile.getCSVHeader(true);
That should give you column names, no?
http://supercsv.sourceforge.net/javadoc/index.html
I think I understand your question now. The String [] argument passed to the function readaccepts the property names of the class you want to read. It is positional, so it does not need to be called as headings. So, for example, you can have String[] header = inFile.getCSVHeader(), but then have a mapping headerName->propertyName, so if your header fields were:
First Name, Last Name, Age
but your class was
getFirstName(), setFirstName(...);
getLastName(), setLastName(...);
getYears(), setYears();
go to the readnot method (String[]) {"First Name", "Last Name", "Age"}as your header, but go to the readarray (String[]) {"FirstName", "LastName", "Years"}.
source
share