Menu

#31 Allow cell processors to be used with variable no of columns

2.1.0
closed
None
5
2014-09-15
2013-04-05
No

Some CSV files don't conform to RFC4180 and have a different number of columns on each row. Currently, that limits people to using CsvListReader without any processors (returned as a List of Strings).

This issue has been reported on StackOverflow as well has on the forums (here and here). It's also related to this other feature request.

Update CsvListReader to allow the execution of cell processors after a row is read.

Discussion

  • James Bassett

    James Bassett - 2013-04-05
    • status: open --> pending
     
  • James Bassett

    James Bassett - 2013-04-05

    Implemented by [r281]

    You can now execute the cell processors after reading a line! (only applicable to CsvListReader)

    while( (listReader.read()) != null ) {
    
      // use different processors depending on the number of columns
      final CellProcessor[] processors;
      if( listReader.length() == noBirthDateProcessors.length ) {
        processors = noBirthDateProcessors;
      } else {
        processors = allProcessors;
      }
    
      final List<Object> customerList = 
        listReader.executeProcessors(processors);
    
    }
    
     

    Related

    Commit: [r281]

  • James Bassett

    James Bassett - 2013-04-24
    • Status: pending --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.