aspose file tools*
The moose likes Java in General and the fly likes question reg. Serialization process Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

question reg. Serialization process

Poornachandran R
Ranch Hand

Joined: Sep 11, 2002
Posts: 47
Hai,
An article from Sun reg the same can be found here
http://developer.java.sun.com/developer/technicalArticles/Programming/serialization/
I have some doubts:
public class A implements Serializable {
private void writeObject(ObjectOutputStream out) throws IOException
{
out.defaultWriteObject();
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
in.defaultReadObject();
}
}
In the above example,
1) Can I give the following line just after line of the method writeObject.
out = new ObjectOutputStream(fos); // assume fos - FileOutputStream.
2) What is the difference between this approach and Externalizable ? Because, in both the approaches we define our own way of how Object is written and read.
Poornachandran
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Poornachandran,
Welcome to JavaRanch, the absolute best site on the www for Java information. We don't have many rules around here, but we do have one. Please change your display name to a first and last name to comply with the JavaRanch Naming Policy. You can change it here. Thank you for your cooperation.
Also, please do not cross post topics. Choose just forum per topic.
Closing this. Please respond
here


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: question reg. Serialization process