Make it slightly easier to read a CSV from a string
@@ -18,14 +18,15 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import java.io.StringReader;
import java.sql.ResultSet;
import java.sql.SQLException;
import tech.tablesaw.api.Table;
import tech.tablesaw.io.csv.CsvReadOptions;
import tech.tablesaw.io.csv.CsvReadOptions.CsvReadOptionsBuilder;
-import tech.tablesaw.io.jdbc.SqlResultSetReader;
import tech.tablesaw.io.csv.CsvReader;
+import tech.tablesaw.io.jdbc.SqlResultSetReader;
public class DataFrameReader {
@@ -33,6 +34,10 @@ public class DataFrameReader {
return csv(CsvReadOptions.builder(file));
}
+ public Table csv(String contents, String tableName) throws IOException {
+ return csv(new StringReader(contents), tableName);
+ }
+
public Table csv(File file) throws IOException {
return csv(CsvReadOptions.builder(file));
}
