BaseFixedLengthImporter extends BaseTextImporter { @Override public int countRows(byte[] bytes, int sheetIndex) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(bytes)))) { int count = 0; String line = reader.readLine(); while (line != null) { count++; line = reader.readLine(); } return count; } catch (IOException ex) { throw new OCSImportException(ex.getMessage(), ex); } }  @Override int countRows(byte[] bytes, int sheetIndex);  }
@Test public void testCountRows() throws IOException { byte[] bytes = readFile("importertest.csv"); int rows = importer.countRows(bytes, 0); assertEquals(7, rows); }