test_class.file: lib/src/test/java/edu/stanford/futuredata/macrobase/ingest/CSVDataFrameWriterTest.java
test_class.identifier: CSVDataFrameWriterTest
test_case.body: @Test
      public void writeToStream() throws Exception {
          StringWriter sb = new StringWriter();
          DataFrame df = new DataFrame();
          String[] col1 = {"a", "b"};
          double[] col2 = {1.0, 2.0};
          df.addColumn("col1", col1);
          df.addColumn("col2", col2);
  
          CSVDataFrameWriter writer = new CSVDataFrameWriter();
          writer.writeToStream(df, sb);
          String out = sb.toString();
          assertEquals(3, out.split("\n").length);
          assertTrue(out.contains("b"));
      }
test_case.class_method_signature: CSVDataFrameWriterTest.writeToStream()
test_case.full_signature: @Test public void writeToStream()
test_case.identifier: writeToStream
test_case.invocations: addColumn addColumn writeToStream toString assertEquals split assertTrue contains
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void writeToStream()
focal_class.declarator: format
focal_class.modifier: private final
focal_class.original_string: private final CsvFormat format;
focal_class.type: CsvFormat
focal_class.var_name: format
focal_class.file: lib/src/main/java/edu/stanford/futuredata/macrobase/ingest/CSVDataFrameWriter.java
focal_class.identifier: CSVDataFrameWriter
focal_class.class_method_signature: CSVDataFrameWriter.CSVDataFrameWriter()
focal_class.full_signature: public  CSVDataFrameWriter()
focal_class.identifier: CSVDataFrameWriter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  CSVDataFrameWriter()
focal_class.class_method_signature: CSVDataFrameWriter.CSVDataFrameWriter(String fieldDelimiter, String lineDelimiter)
focal_class.full_signature: public  CSVDataFrameWriter(String fieldDelimiter, String lineDelimiter)
focal_class.identifier: CSVDataFrameWriter
focal_class.modifiers: public
focal_class.parameters: (String fieldDelimiter, String lineDelimiter)
focal_class.signature:  CSVDataFrameWriter(String fieldDelimiter, String lineDelimiter)
focal_class.class_method_signature: CSVDataFrameWriter.writeToStream(DataFrame df, Writer out)
focal_class.full_signature: public void writeToStream(DataFrame df, Writer out)
focal_class.identifier: writeToStream
focal_class.modifiers: public
focal_class.parameters: (DataFrame df, Writer out)
focal_class.return: void
focal_class.signature: void writeToStream(DataFrame df, Writer out)
focal_method.body: public void writeToStream(DataFrame df, Writer out) throws IOException {
          String[] columnNames = df.getSchema().getColumnNames().toArray(new String[0]);
          final CsvWriterSettings settings = new CsvWriterSettings();
          settings.setFormat(format);
          CsvWriter writer = new CsvWriter(out, settings);
          writer.writeHeaders(columnNames);
  
          for (Row curRow : df.getRowIterator()) {
              List<Object> rowValues = curRow.getVals();
              writer.writeRow(rowValues);
          }
          writer.close();
      }
focal_method.class_method_signature: CSVDataFrameWriter.writeToStream(DataFrame df, Writer out)
focal_method.full_signature: public void writeToStream(DataFrame df, Writer out)
focal_method.identifier: writeToStream
focal_method.invocations: toArray getColumnNames getSchema setFormat writeHeaders getRowIterator getVals writeRow close
focal_method.modifiers: public
focal_method.parameters: (DataFrame df, Writer out)
focal_method.return: void
focal_method.signature: void writeToStream(DataFrame df, Writer out)