AlistairMonkeyFinger
Programmer
Hi,
I'm writing an application that opens up a specific type of data file into a JTable. If the file is small then copied the data into Vector then created a class that extends AbstractTableModel to access the data from the Vector. Most of the data is Strings but some is of a new type Chem that has it's own renderer which is why i've done it this way. This is fine for small to medium files, but for very big files then memory is a problem. To my question...
Is it possible to create some code in the
section of your TableModel class to access a position in a file directly ?
Obviously this would slow the table down a fair amount as the user scrolls down but it would mean that a user could have access to a very large data file all at once. I had a look at the InputStream class, there is a Mark method but it only creates one mark rather then allowing me to mark every 'record'. Maybe i could use the CharArrayReader if i somehow parsed the file and stored the locations of all the records then used
??
Any ideas ? Alistair
I'm writing an application that opens up a specific type of data file into a JTable. If the file is small then copied the data into Vector then created a class that extends AbstractTableModel to access the data from the Vector. Most of the data is Strings but some is of a new type Chem that has it's own renderer which is why i've done it this way. This is fine for small to medium files, but for very big files then memory is a problem. To my question...
Is it possible to create some code in the
Code:
public Object getValueAt(int row, int column)
Obviously this would slow the table down a fair amount as the user scrolls down but it would mean that a user could have access to a very large data file all at once. I had a look at the InputStream class, there is a Mark method but it only creates one mark rather then allowing me to mark every 'record'. Maybe i could use the CharArrayReader if i somehow parsed the file and stored the locations of all the records then used
Code:
read(char[] b, int off, int len)
Any ideas ? Alistair