/** * Customized CSV parser using the given {@link CSVFormat} * * <p> * If you do not read all records from the given {@code reader}, you should call {@link #close()} on the parser, * unless you close the {@code reader}. * </p> * * @param reader * a Reader containing CSV-formatted input. Must not be null. * @param format * the CSVFormat used for CSV parsing. Must not be null. * @throws IllegalArgumentException * If the parameters of the format are inconsistent or if either reader or format are null. * @throws IOException * If an I/O error occurs */ public CSVParser(final Reader reader, final CSVFormat format) throws IOException { Args.notNull(reader, "reader"); Args.notNull(format, "format"); format.validate(); this.format = format; this.lexer = new Lexer(format, new ExtendedBufferedReader(reader)); this.headerMap = this.initializeHeader(); }