The above reading code assumes that there is only one object in the file if there were more than one object written to the file from the list what should the reading code look like. How could i determine the total no of ojects in a file and read each one consecutively ???
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2329
posted
0
You can either write the number of objects as an integer to the file before all the objects, or you can keep reading objects until the input stream is exhausted, or you could just serialize the array list to the file instead of its member objects.
Rajesh Khan
Ranch Hand
Joined: Oct 16, 2011
Posts: 224
posted
0
Tim Moores wrote:You can either write the number of objects as an integer to the file before all the objects, or you can keep reading objects until the input stream is exhausted, or you could just serialize the array list to the file instead of its member objects.
How could i serialize the arraylist ?? I thought object were suppose to implement the serializable interface it they had to be serialized