I am using SuperCSV to parse CSV records into JavaBean. My CSV files have 10 columns with a headers row in starting. These files can have records up to 10k.I want to process records having equal number of columns with headers . Suppose if a record is having only 9 columns I want to skip parsing that row and and read next row.
I define String[] mapping for all 10 columns and CellProcessor[] of same size. I am using icsvBeanReader for processing.Please suggest solution for this.
sample csv file :
header1,header2,header3,header4,header5,header6,header7,header8,heade9,head10
v1,v2,v3,v4,v5,v6,v7,v8,v9,v10-->row1
v1,v2,v3,v4,v5,v6,v7,v8,v9,v10-->row2
v1,v2,v3,v4,v5,v6,v7,v8,v9-->row3
v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11-->row4
v1,v2,v3,v4,v5,v6,v7,v8,v9,v10-->row5
v1,v2,v3,v4,v5,v6,v7,v8,v9,v10-->row6
If above file is my sample input csv. I want to process row1,row2,row5 and row6 only since number of columns in row3 ,row4 are not matching with headers size..
I dont want to use CsvList reader because through out file my records are fixed and I am using custom cell processors to handle validations on each colomn. Just in case if data is missing in a row ,I would like to skip and continue processecing other record/rows.As of now IcsvBean reader throwing exception if column numbers not matched with name mappings. Please help me on this.