My task is to display data in text.DAT file in the form of tables.I am trying to do this with Java. I am using a Swing JTable
for creating table but as the text file is 500 Mb, Java heap memory is overflowing. I understand this is due to every object that is being created for every row of table.
Is there any method to resolve this without increasing heap memory?
Relevant code is this:-
JFrame f = new JFrame();
JTable tbl = new JTable();
DefaultTableModel dtm = new DefaultTableModel(0, 0);
line = br.readLine();
String[] header = line.split(delimiter);
dtm.setColumnIdentifiers(header);
tbl.setModel(dtm);
while ((line = br.readLine()) != null) {
String[] data = line.split(delimiter);
dtm.addRow(data);
}
JScrollPane sp = new JScrollPane(tbl);
f.add(sp);