How can I modify a serialized object which is stored in a file if the file contains a large number of objects?
Location: http://www.jguru.com/faq/view.jsp?EID=114601 Created: Jul 30, 2000 Modified: 2000-07-31 12:16:49.23 Author: Doug Bell (http://www.jguru.com/guru/viewbio.jsp?EID=113602) Question originally posed by balaji chittu (http://www.jguru.com/guru/viewbio.jsp?EID=95194 The short answer is that you probably can’t without deserializing the objects and reserializing and rewriting the objects. The serialized format is truly a stream-oriented protocol and does not support random access–it is both self-referential and incremental. When an object is written to the stream, a description of the class and its non-static and non-transient fields (including any Serializable superclasses and their non-static and non-transient fields) is also written to the steam. Then the entire object graph of non-transient fields of Serializable classes is written, which means that non-null object references to serializable objects are recursively serialized. Throughout this process, object identity is maintain