@Test public void testParser () throws Exception { Parser p = new SuperCsvParserFactory ().parse (new ByteArrayInputStream (("\t\tsa\tsb\tsc\n" + "g1\tp1\t.1\t.2\t.3\n" + "g2\tp2\t.4\t.5\t.6").getBytes ())); for (int index = 1; index < 7; index++) { assertTrue (p.next ()); assertEquals (index / 10.0, p.value (), 0.0); } assertFalse (p.next ()); List<String> expectedColumns = new ArrayList<String>(){ private static final long serialVersionUID = 1L; { add("sa"); add("sb"); add("sc"); }}; assertThat(p.columnKeys (), is(expectedColumns)); List<String> expectedRows= new ArrayList<String>(){ private static final long serialVersionUID = 1L; { add("g1"); add("g2"); }}; assertThat(p.rowKeys (), is(expectedRows)); }
@Override public SuperCsvParser parse (InputStream input) throws DatasetBuilderException { return new SuperCsvParser (new CsvListReader (new InputStreamReader (input), new Builder (quoteChar, separatorChar, endOfLineSymbols).skipComments (new CommentMatcher () { @Override public boolean isComment (String line) { for (Pattern pattern : commentRegExpressions) if (pattern.matcher (line).matches ()) return true; return false; } }).build ()), rowIdParser); }
SuperCsvParserFactory extends AbstractParserFactory { @Override public SuperCsvParser parse (InputStream input) throws DatasetBuilderException { return new SuperCsvParser (new CsvListReader (new InputStreamReader (input), new Builder (quoteChar, separatorChar, endOfLineSymbols).skipComments (new CommentMatcher () { @Override public boolean isComment (String line) { for (Pattern pattern : commentRegExpressions) if (pattern.matcher (line).matches ()) return true; return false; } }).build ()), rowIdParser); } }
SuperCsvParserFactory extends AbstractParserFactory { @Override public SuperCsvParser parse (InputStream input) throws DatasetBuilderException { return new SuperCsvParser (new CsvListReader (new InputStreamReader (input), new Builder (quoteChar, separatorChar, endOfLineSymbols).skipComments (new CommentMatcher () { @Override public boolean isComment (String line) { for (Pattern pattern : commentRegExpressions) if (pattern.matcher (line).matches ()) return true; return false; } }).build ()), rowIdParser); } SuperCsvParserFactory(SuperCsvParser.RowIdParser rowIdParser); }
SuperCsvParserFactory extends AbstractParserFactory { @Override public SuperCsvParser parse (InputStream input) throws DatasetBuilderException { return new SuperCsvParser (new CsvListReader (new InputStreamReader (input), new Builder (quoteChar, separatorChar, endOfLineSymbols).skipComments (new CommentMatcher () { @Override public boolean isComment (String line) { for (Pattern pattern : commentRegExpressions) if (pattern.matcher (line).matches ()) return true; return false; } }).build ()), rowIdParser); } SuperCsvParserFactory(SuperCsvParser.RowIdParser rowIdParser); SuperCsvParserFactory quoteChar(char quoteChar); @Override void addCommentRegExpression(String regex); SuperCsvParserFactory separatorChar(int separatorChar); SuperCsvParserFactory endOfLineSymbols(String endOfLineSymbols); SuperCsvParserFactory commentRegExpressions(String... commentRegExpressions); @Override String contentType(); @Override SuperCsvParser parse(InputStream input); }
SuperCsvParserFactory extends AbstractParserFactory { @Override public SuperCsvParser parse (InputStream input) throws DatasetBuilderException { return new SuperCsvParser (new CsvListReader (new InputStreamReader (input), new Builder (quoteChar, separatorChar, endOfLineSymbols).skipComments (new CommentMatcher () { @Override public boolean isComment (String line) { for (Pattern pattern : commentRegExpressions) if (pattern.matcher (line).matches ()) return true; return false; } }).build ()), rowIdParser); } SuperCsvParserFactory(SuperCsvParser.RowIdParser rowIdParser); SuperCsvParserFactory quoteChar(char quoteChar); @Override void addCommentRegExpression(String regex); SuperCsvParserFactory separatorChar(int separatorChar); SuperCsvParserFactory endOfLineSymbols(String endOfLineSymbols); SuperCsvParserFactory commentRegExpressions(String... commentRegExpressions); @Override String contentType(); @Override SuperCsvParser parse(InputStream input);  }