Question :When a Serializable object is written with writeObject, then modified and
written a second time, why is the modification missing when the stream is
deserialized? (CoreJava)
Answer :The ObjectOutputStream class keeps track of each object it serializes and
sends only the handle if the object is written into the stream a subsequent
time. This is the way it deals with graphs of objects. The corresponding
ObjectInputStream keeps track of all of the objects it has created and their
handles so when the handle is seen again it can return the same object.
Both output and input streams keep this state until they are freed.
Alternatively, the ObjectOutputStream class implements a reset method
that discards the memory of having sent an objecct, so sending an object
again will make a copy.
www.interviewhelper.org is a hope for all the Job seekers. Users can find unlimited here. These range from technical to HR, from functional to behavioral. www.interviewhelper.org contains in the fields like Ajax,VB,Networking,Sharepoint,JEE,Perl,Javascript,Bioinformatics,Classic ASP,Unix,Linux,Accounting,Oracle DBA,Microprocessor,Bluetooth,jms,jme,.net framework,ABAP,ASP,ASP.net,Basic .net Framework,Interview Questions,C language,C++,database,Oracle,Java,PHP,LAMP,SAP etc.
Thursday, March 12, 2009
When a Serializable object is written with writeObject, then modified and
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment