I have serialized my resultset into a file on the harddisk and converted it back into resultsetWhy? What exactly is the point? A RowSet represents the result of a query at a particular moment in time. One database update later it is obsolete. So what is to be gained by writing it to a file and reading it back? In all probability it would be more efficient to execute the query again instead.
reading and writing taking too much timeCompared to what?
Iteration with same data took 7 secondsIs that iterating over the original ResultSet or the one you fetched from the file?
Can we set the buffer size of outputstream and inputstream ??Sure, put a BufferedOutputStream between the FileOutputStream and the ObjectOutputStream, and similarly with BufferedInputStream. You can control the buffer sizes of both.
user6654 wrote:You still didn't answer why you are serializing and deserilizing the result set. May be you are taking some wrong approach?
After setting the buffer size of objectoutputstream, it is saving the object in 8 seconds in place of 40 seconds.
but again inspite of setting the buffer size of objectinputstream reading the object dosn,t become faster it is taking more than a minute which is not acceptable can you help me in that please.
user6654 wrote:Are you saying that the same code with "new ByteArrayOutputStream()" takes 40 seconds and with "new ByteArrayOutputStream(8192)" it takes 8-10 seconds? If find that highly unlikely, because using the default buffer size of the BAOS initially should only result in at most 8 more resize-operations, which are very cheap array copies of small-ish byte-arrays. Those should definitely not take 30 seconds longer.
when i set the buffer size like ByteArrayOutputStream out = new ByteArrayOutputStream(8192); in the previous code it stated performing ok.