@Test public void too_many_characters() throws Exception { InputStream infinite = new InputStream() { @Override public int read() throws IOException { return 'a'; } }; CsvConfiguration conf = createConfiguration(); try (CsvParser parser = new CsvParser(infinite, "testing", conf)) { assertThat(parser.next(), is(true)); fail(); } catch (IOException e) { } }
@Override public boolean next() throws CsvFormatException, IOException { exceptionStatus = null; currentRecordNumber++; if (firstLine) { firstLine = false; decodeLine(); if (isEof()) { return false; } if (isHeader()) { decodeLine(); } } else { decodeLine(); } if (exceptionStatus != null) { throw new CsvFormatException(exceptionStatus, null); } return isEof() == false; }
CsvParser implements RecordParser { @Override public boolean next() throws CsvFormatException, IOException { exceptionStatus = null; currentRecordNumber++; if (firstLine) { firstLine = false; decodeLine(); if (isEof()) { return false; } if (isHeader()) { decodeLine(); } } else { decodeLine(); } if (exceptionStatus != null) { throw new CsvFormatException(exceptionStatus, null); } return isEof() == false; } }
CsvParser implements RecordParser { @Override public boolean next() throws CsvFormatException, IOException { exceptionStatus = null; currentRecordNumber++; if (firstLine) { firstLine = false; decodeLine(); if (isEof()) { return false; } if (isHeader()) { decodeLine(); } } else { decodeLine(); } if (exceptionStatus != null) { throw new CsvFormatException(exceptionStatus, null); } return isEof() == false; } CsvParser(InputStream stream, String path, CsvConfiguration config); }
CsvParser implements RecordParser { @Override public boolean next() throws CsvFormatException, IOException { exceptionStatus = null; currentRecordNumber++; if (firstLine) { firstLine = false; decodeLine(); if (isEof()) { return false; } if (isHeader()) { decodeLine(); } } else { decodeLine(); } if (exceptionStatus != null) { throw new CsvFormatException(exceptionStatus, null); } return isEof() == false; } CsvParser(InputStream stream, String path, CsvConfiguration config); @Override boolean next(); String getPath(); long getCurrentLineNumber(); long getCurrentRecordNumber(); @SuppressWarnings("deprecation") @Override void fill(BooleanOption option); @Override void fill(ByteOption option); @Override void fill(ShortOption option); @Override void fill(IntOption option); @Override void fill(LongOption option); @Override void fill(FloatOption option); @Override void fill(DoubleOption option); @Override void fill(DecimalOption option); @SuppressWarnings("deprecation") @Override void fill(StringOption option); @Override void fill(DateOption option); @Override void fill(DateTimeOption option); @Override void endRecord(); @Override void close(); }
CsvParser implements RecordParser { @Override public boolean next() throws CsvFormatException, IOException { exceptionStatus = null; currentRecordNumber++; if (firstLine) { firstLine = false; decodeLine(); if (isEof()) { return false; } if (isHeader()) { decodeLine(); } } else { decodeLine(); } if (exceptionStatus != null) { throw new CsvFormatException(exceptionStatus, null); } return isEof() == false; } CsvParser(InputStream stream, String path, CsvConfiguration config); @Override boolean next(); String getPath(); long getCurrentLineNumber(); long getCurrentRecordNumber(); @SuppressWarnings("deprecation") @Override void fill(BooleanOption option); @Override void fill(ByteOption option); @Override void fill(ShortOption option); @Override void fill(IntOption option); @Override void fill(LongOption option); @Override void fill(FloatOption option); @Override void fill(DoubleOption option); @Override void fill(DecimalOption option); @SuppressWarnings("deprecation") @Override void fill(StringOption option); @Override void fill(DateOption option); @Override void fill(DateTimeOption option); @Override void endRecord(); @Override void close();  }