I am using uniVocity in order to parse two different files. For every line of the first file I need to iterate through file 2 in order to make some comparisons.
RowListProcessor rowProcessor = new RowListProcessor();
CsvParserSettings settings = new CsvParserSettings();
settings.setRowProcessor(rowProcessor);
settings.setLineSeparatorDetectionEnabled(true);
settings.setHeaderExtractionEnabled(true);
settings.setSkipEmptyLines(true);
CsvParser file1Parser = new CsvParser(settings);
CsvParser file2Parser = new CsvParser(settings);
Do I need to use different CsvParserSettings
for the two parsers, or is there some other way to define rowProcessor
s?
Also how can I read the files line by line in order to perform the operations I need in each line?
You can use the same settings, but will need new
rowProcessor
for each parser if you are going to run both parsers at the same time.However, from what you described it seems you'd be fine by not using a row processor and just iterate over the rows produced by each parser. In this case just get rid of the row processors, and do this:
Hope this helps.