/** * Performs the {@link CsvWorker#processLine(String[], String[], int)} * method of the {@code worker} parameter for each link in the CSV, * and closes the underlying {@link CSVReader}. * * @param worker the {@code CsvWorker} that performs work on each line * @throws IOException if the CSV file cannot be read */ public void processReader(CsvWorker worker) throws IOException { createCsvReader(); try { String[] line; while ((line = reader.readNext()) != null) { worker.processLine(header, line, lineNumber); lineNumber++; } } finally { reader.close(); } }
/** * Performs the {@link CsvWorker#processLine(String[], String[], int)} * method of the {@code worker} parameter for each link in the CSV, * and closes the underlying {@link CSVReader}. * * @param worker the {@code CsvWorker} that performs work on each line * @throws IOException if the CSV file cannot be read */ public void processReader(CsvWorker worker) throws IOException { createCsvReader(); try { String[] line; while ((line = reader.readNext()) != null) { worker.processLine(header, line, lineNumber); lineNumber++; } } finally { reader.close(); } }