• Post Reply Bookmark Topic Watch Topic
  • New Topic

Rewrite the object without reopen the same file.

 
shan raj
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to perform the read and write the content operation in the file. For this I have created Serialized class to write and read from the file using ObjectInputStream and ObjectOutputStream. If I open and close every time its working fine. But every time open and close the file for read and write might be costly operation. I would like to know is there any better way to do this without closing the file for every time.

Thanks
Shan
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shan raj wrote:But every time open and close the file for read and write might be costly operation. I would like to know is there any better way to do this without closing the file for every time.


The operative word is "might". In our EnterprisePerformance FAQ, item #1 is: "Measure, don't guess". You need to get a benchmark of your current strategy in order to compare the alternatives.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!