aspose file tools*
The moose likes Java in General and the fly likes Please explain writeObject() ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Please explain writeObject() ..." Watch "Please explain writeObject() ..." New topic
Author

Please explain writeObject() ...

achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
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 ]

humanum errare est.
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
This is not a Servlet specific question so I am moving it to Java Intermediate.


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Pete Lyons
Ranch Hand

Joined: Aug 18, 2002
Posts: 109
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please explain writeObject() ...
 
Similar Threads
Solved : Can someone help with Object Input/Output Stream...
Serialization Problem
Threads,serialisation, static variables - java basic doubts
WebSphere dynamic cache and serialization
request.setAttribute()