@Test void add() throws IOException { StringWriter strWriter = new StringWriter(); try (CsvWriter csvWriter = new CsvWriter(strWriter)) { csvWriter.writeAttributeNames(Arrays.asList("col1", "col2")); Entity entity = new DynamicEntity(entityType); entity.set("col1", "val1"); entity.set("col2", "val2"); csvWriter.add(entity); assertEquals("\"col1\",\"col2\"\n\"val1\",\"val2\"\n", strWriter.toString()); } }
@Override public void add(Entity entity) { if (cachedAttributeNames == null) throw new MolgenisDataException("No attribute names defined call writeAttributeNames first"); int i = 0; String[] values = new String[cachedAttributeNames.size()]; for (String colName : cachedAttributeNames) { values[i++] = toValue(entity.get(colName)); } csvWriter.writeNext(values); if (csvWriter.checkError()) throw new MolgenisDataException("An exception occured writing the csv file"); }
CsvWriter extends AbstractWritable { @Override public void add(Entity entity) { if (cachedAttributeNames == null) throw new MolgenisDataException("No attribute names defined call writeAttributeNames first"); int i = 0; String[] values = new String[cachedAttributeNames.size()]; for (String colName : cachedAttributeNames) { values[i++] = toValue(entity.get(colName)); } csvWriter.writeNext(values); if (csvWriter.checkError()) throw new MolgenisDataException("An exception occured writing the csv file"); } }
CsvWriter extends AbstractWritable { @Override public void add(Entity entity) { if (cachedAttributeNames == null) throw new MolgenisDataException("No attribute names defined call writeAttributeNames first"); int i = 0; String[] values = new String[cachedAttributeNames.size()]; for (String colName : cachedAttributeNames) { values[i++] = toValue(entity.get(colName)); } csvWriter.writeNext(values); if (csvWriter.checkError()) throw new MolgenisDataException("An exception occured writing the csv file"); } CsvWriter(Writer writer);  CsvWriter(Writer writer, char separator);  CsvWriter(Writer writer, char separator, boolean noQuotes);  CsvWriter(OutputStream os, char separator);  CsvWriter(OutputStream os, char separator, boolean noQuotes); }
CsvWriter extends AbstractWritable { @Override public void add(Entity entity) { if (cachedAttributeNames == null) throw new MolgenisDataException("No attribute names defined call writeAttributeNames first"); int i = 0; String[] values = new String[cachedAttributeNames.size()]; for (String colName : cachedAttributeNames) { values[i++] = toValue(entity.get(colName)); } csvWriter.writeNext(values); if (csvWriter.checkError()) throw new MolgenisDataException("An exception occured writing the csv file"); } CsvWriter(Writer writer);  CsvWriter(Writer writer, char separator);  CsvWriter(Writer writer, char separator, boolean noQuotes);  CsvWriter(OutputStream os, char separator);  CsvWriter(OutputStream os, char separator, boolean noQuotes); void addCellProcessor(CellProcessor cellProcessor); @Override void add(Entity entity); void writeAttributeNames(Iterable<String> attributeNames); void writeAttributes(Iterable<Attribute> attributes); void writeAttributes(Iterable<String> attributeNames, Iterable<String> attributeLabels); @Override void close(); @Override void flush(); @Override void clearCache(); }
CsvWriter extends AbstractWritable { @Override public void add(Entity entity) { if (cachedAttributeNames == null) throw new MolgenisDataException("No attribute names defined call writeAttributeNames first"); int i = 0; String[] values = new String[cachedAttributeNames.size()]; for (String colName : cachedAttributeNames) { values[i++] = toValue(entity.get(colName)); } csvWriter.writeNext(values); if (csvWriter.checkError()) throw new MolgenisDataException("An exception occured writing the csv file"); } CsvWriter(Writer writer);  CsvWriter(Writer writer, char separator);  CsvWriter(Writer writer, char separator, boolean noQuotes);  CsvWriter(OutputStream os, char separator);  CsvWriter(OutputStream os, char separator, boolean noQuotes); void addCellProcessor(CellProcessor cellProcessor); @Override void add(Entity entity); void writeAttributeNames(Iterable<String> attributeNames); void writeAttributes(Iterable<Attribute> attributes); void writeAttributes(Iterable<String> attributeNames, Iterable<String> attributeLabels); @Override void close(); @Override void flush(); @Override void clearCache();  }