@Test public void testSave_ToWriter() { DataFrame df = DataFrame.newFrame("A", "B").foldByRow( 1, 2, 3, 4); StringWriter out = new StringWriter(); Csv.saver().save(df, out); assertEquals("A,B\r\n" + "1,2\r\n" + "3,4\r\n", out.toString()); }
public void save(DataFrame df, File file) { if (createMissingDirs) { File dir = file.getParentFile(); if (dir != null) { dir.mkdirs(); } } try (FileWriter out = new FileWriter(file)) { save(df, out); } catch (IOException e) { throw new RuntimeException("Error writing CSV to " + file + ": " + e.getMessage(), e); } }
CsvSaver { public void save(DataFrame df, File file) { if (createMissingDirs) { File dir = file.getParentFile(); if (dir != null) { dir.mkdirs(); } } try (FileWriter out = new FileWriter(file)) { save(df, out); } catch (IOException e) { throw new RuntimeException("Error writing CSV to " + file + ": " + e.getMessage(), e); } } }
CsvSaver { public void save(DataFrame df, File file) { if (createMissingDirs) { File dir = file.getParentFile(); if (dir != null) { dir.mkdirs(); } } try (FileWriter out = new FileWriter(file)) { save(df, out); } catch (IOException e) { throw new RuntimeException("Error writing CSV to " + file + ": " + e.getMessage(), e); } } CsvSaver(); }
CsvSaver { public void save(DataFrame df, File file) { if (createMissingDirs) { File dir = file.getParentFile(); if (dir != null) { dir.mkdirs(); } } try (FileWriter out = new FileWriter(file)) { save(df, out); } catch (IOException e) { throw new RuntimeException("Error writing CSV to " + file + ": " + e.getMessage(), e); } } CsvSaver(); CsvSaver format(CSVFormat format); CsvSaver createMissingDirs(); CsvSaver noHeader(); void save(DataFrame df, File file); void save(DataFrame df, String fileName); void save(DataFrame df, Appendable out); String saveToString(DataFrame df); }
CsvSaver { public void save(DataFrame df, File file) { if (createMissingDirs) { File dir = file.getParentFile(); if (dir != null) { dir.mkdirs(); } } try (FileWriter out = new FileWriter(file)) { save(df, out); } catch (IOException e) { throw new RuntimeException("Error writing CSV to " + file + ": " + e.getMessage(), e); } } CsvSaver(); CsvSaver format(CSVFormat format); CsvSaver createMissingDirs(); CsvSaver noHeader(); void save(DataFrame df, File file); void save(DataFrame df, String fileName); void save(DataFrame df, Appendable out); String saveToString(DataFrame df);  }