/** * Closes the Tokenizer and its associated Reader. */ public void close() throws IOException { tokenizer.close(); }
/** * {@inheritDoc} */ public int getLineNumber() { return tokenizer.getLineNumber(); }
/** * {@inheritDoc} */ public String getUntokenizedRow() { return tokenizer.getUntokenizedRow(); }
/** * Calls the tokenizer to read a CSV row. The columns can then be retrieved using {@link #getColumns()}. * * @return true if something was read, and false if EOF * @throws IOException * when an IOException occurs * @throws SuperCsvException * on errors in parsing the input */ protected boolean readRow() throws IOException { if( tokenizer.readColumns(columns) ) { rowNumber++; return true; } return false; }
/** * {@inheritDoc} */ public String[] getHeader(final boolean firstLineCheck) throws IOException { if( firstLineCheck && tokenizer.getLineNumber() != 0 ) { throw new SuperCsvException(String.format( "CSV header must be fetched as the first read operation, but %d lines have already been read", tokenizer.getLineNumber())); } if( readRow() ) { return columns.toArray(new String[columns.size()]); } return null; }