提交 2a98b9af authored 作者: Thomas Mueller's avatar Thomas Mueller

The constructor for Csv objects is now public, and Csv.getInstance() is now deprecated.

上级 c0773c43
......@@ -939,7 +939,7 @@ public class MetaTable extends Table {
try {
byte[] data = Utils.getResource(resource);
Reader reader = new InputStreamReader(new ByteArrayInputStream(data));
Csv csv = Csv.getInstance();
Csv csv = new Csv();
csv.setLineCommentCharacter('#');
ResultSet rs = csv.read(reader, null);
for (int i = 0; rs.next(); i++) {
......
......@@ -45,14 +45,14 @@ public class CsvSample {
rs.addColumn("PHONE", Types.VARCHAR, 255, 0);
rs.addRow("Bob Meier", "bob.meier@abcde.abc", "+41123456789");
rs.addRow("John Jones", "john.jones@abcde.abc", "+41976543210");
Csv.getInstance().write("data/test.csv", rs, null);
new Csv().write("data/test.csv", rs, null);
}
/**
* Read a CSV file.
*/
static void read() throws SQLException {
ResultSet rs = Csv.getInstance().read("data/test.csv", null, null);
ResultSet rs = new Csv().read("data/test.csv", null, null);
ResultSetMetaData meta = rs.getMetaData();
while (rs.next()) {
for (int i = 0; i < meta.getColumnCount(); i++) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论