Hi. I am using ObjectOutputStream and writeObject, and I am trying to write two Strings in it. Okay, so it compiles, but it would be nice to understand how JAVA knows where the field "model" ends and the next field "colour" starts. I mean : if we were to use readObject(), how does the read know there are 2 fields ???
Sometimes I really like to know why JAA works in a particular way. I see it as an overly complex language. [ November 21, 2002: Message edited by: achana chan ]
The Serialization Tutorial explains some of how serialization works. If you're curious, detailed explainations of the binary format can be found on the web, or just open the file up in a text editor. Basically, you should not need to worry about the implementation details, which is why it's easy to serialize objects in some languages. Of course, the source code to ObjectOutputStream is always there for the real truth. You also might be curious about java.beans.XMLDecoder to see an alternate file format for the stored object graph.