/** * Creates a printer that will print values to the given stream following the CSVFormat. * <p/> * Currently, only a pure encapsulation format or a pure escaping format is supported. Hybrid formats * (encapsulation and escaping with a different character) are not supported. * * @param out * stream to which to print. Must not be null. * @param format * the CSV format. Must not be null. * @throws IllegalArgumentException * thrown if the parameters of the format are inconsistent or if either out or format are null. */ public CSVPrinter(final Appendable out, final CSVFormat format) { Args.notNull(out, "out"); Args.notNull(format, "format"); this.out = out; this.format = format; this.format.validate(); }
/** * 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(); }