saving Object[][] via ObjectOutputStream
Hopefully someone can help me with the following problem:
here a two scenarios and I am trying to solve the latter. (the question is: Why it takes a lot more time to save an Object-array than a double-array?
1) putting the information (stockmarket data) in a double[8][3000] . then putting this info in an ArrayList and via ObjectOutputStream write the data to a file.
[double] [double] [double] [double] [double] [double] [double] [double] [double]
this takes approx. 4 seconds. OK!!!!
2) putting the information (stockmarket data) in an Object[8][3000] where the first column is String (date) and the rest is Double. Then via ObjectOutputStream write the data to a file.
[String] [double] [double] [double] [double] [double] [double] [double] [double]
this takes approx. 30 seconds. NOT OK!!!:@:
..............................
I suspect that the problem is the ObjectOutputStream. Its no problem (not time consuming) to store the data in an Object [][]. The time-consuming part is when the data is written to a file.
---------------------------------------------
about the data: Stockmarketdata information whis i stored in an two-dim. array with 8 columns and 3000 rows (tradingdays)
date | open | | high | low | close | volume | nmbr of stocks | adj close.
The reason why I want to put the information in an Object is because I want to store it graphically in the JTable Class whis takes Object as an argument and at the same time be able to have string values in the first column (date) and double values in the others.
Regards
Björn
Re: saving Object[][] via ObjectOutputStream
Re: saving Object[][] via ObjectOutputStream
You can write them yourself to disk usinf a buffered stream... I guess this is a lot faster for many items.
Re: saving Object[][] via ObjectOutputStream
Create a class representing this data (assuming you haven't already got one).
Hand a List of that class to your TableModel. Have a TableModel that knows how to pass this data to the Table when asked for it.
That's part 1.
Part 2 is try and serialise this class, with all the data. If that's still crap, then do as Sierra suggets and write your own. You;ve only got 8 fields, so that's hardly complex and will save on the overhead of class data that has to be serialised as well.