groovycsv icon indicating copy to clipboard operation
groovycsv copied to clipboard

Terrible design

Open xpusostomos opened this issue 3 years ago • 0 comments

As far as I can see, this is terribly designed, because you can't get access to the column names until you've actually read the first line of real data. The column names is private in CsvIterator, which makes it impossible to get to... but even if you could get to it, it would still be awful. The CsvParser should take as arguments the things that relate to the whole file, and the CsvIterator should limit its domain to things relating to each line of data. Like this:

CsvParser p = new CsvParser(inputStreamReader, separator: ',') for (String n in p.columns) { println(n) } for (line in p.parse()) { // process line here. }

xpusostomos avatar Jun 22 '21 02:06 xpusostomos