/** * Closes resources. * * @throws IOException * If an I/O error occurs */ void close() throws IOException { in.close(); } }
/** * Returns the current line number * * @return the current line number */ long getCurrentLineNumber() { return in.getCurrentLineNumber(); }
boolean isClosed() { return in.isClosed(); }
/** * Greedily accepts \n, \r and \r\n This checker consumes silently the second control-character... * * @return true if the given or next character is a line-terminator */ boolean readEndOfLine(int ch) throws IOException { // check if we have \r\n... if (ch == CR && in.lookAhead() == LF) { // note: does not change ch outside of this method! ch = in.read(); } return ch == LF || ch == CR; }
int c; while (true) { c = in.read(); token.content.append((char) c).append((char) in.getLastChar()); } else { token.content.append((char) unescaped); if (isQuoteChar(in.lookAhead())) { c = in.read(); token.content.append((char) c); } else { c = in.read(); if (isDelimiter(c)) { token.type = TOKEN;
int lastChar = in.getLastChar(); int c = in.read(); c = in.read(); eol = readEndOfLine(c); final String line = in.readLine(); if (line == null) { token.type = EOF; c = in.read(); eol = readEndOfLine(c);
final int unescaped = readEscape(); if (unescaped == Constants.END_OF_STREAM) { // unexpected char after escape token.content.append((char) ch).append((char) in.getLastChar()); } else { token.content.append((char) unescaped); ch = in.read(); // continue } else { token.content.append((char) ch); ch = in.read(); // continue
final int ch = in.read(); switch (ch) { case 'r':
/** * 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(); }