ModelIO Readers and Writers
ModelIO imports and exports TableModel to multiple formats, such as csv, html, txt
CSV Format
CSV format, colon separated format, used in multiple applications and databases. ModelIO can import and export csv format.

Code Samples:

// import csv model
File f = new File("tmp.csv");
Map map = new HashMap(1);
map.put(ModelIO.ENABLE_LOOSE_FORMAT, Boolean.TRUE);
TableModel model = ModelIO.readTableModel(f, "csv", map)

// export csv model
File f = new File("tmp.csv");
Map map = new HashMap(1);
map.put(ModelIO.ENABLE_LOOSE_FORMAT, Boolean.TRUE);
TableModel model = createTableModel();
ModelIO.writeTableModel(model, "csv", map, f);
TAB Separated Format
ModelIO can import and export TAB separated format.

Code Samples:

// import csv model
File f = new File("tmp.txt");
Map map = new HashMap(1);
map.put(ModelIO.ENABLE_LOOSE_FORMAT, Boolean.TRUE);
TableModel model = ModelIO.readTableModel(f, "txt", map)

// export txt model
File f = new File("tmp.txt");
Map map = new HashMap(1);
map.put(ModelIO.ENABLE_LOOSE_FORMAT, Boolean.TRUE);
TableModel model = createTableModel();
ModelIO.writeTableModel(model, "txt", map, f);
HTML Format
ModelIO can import and export web page file. It is very useful for publishing the TableModel to web page.

Code Samples:

// import csv model
File f = new File("tmp.html");
TableModel model = ModelIO.readTableModel(f, "html", null)

// export html model
File f = new File("tmp.html");
ModelIO.writeTableModel(model, "html", null, f);