| Author |
I am not getting K&B page 445
|
Arun Maalik
Ranch Hand
Joined: Oct 25, 2005
Posts: 216
|
|
Dear sir It has been writter in K&B* of page 445 that in object Serialization when we perform writeObject(). It perform two task: it serializes the object then it writes the serialized object to file. Now i am not getting one thing that what is diffrence between serializes and then writing to file.I was knowing that serialization means writing object to a file. But i got confuse with this book at this point that serialization and writing both are diffrence thing. So pls clearify that what is serialization then writing. Also i would like to know one thing that as we know that when we write statment like first p=new first()//first is a class * Although K&B book is very nice book. here object of type class will create on heap and p is a refrence now when we write objs.writeObject(p) in this case what will written to a file either object or refrence. with regard Arun kumar maalik
|
 |
Sai Surya
Ranch Hand
Joined: Feb 08, 2006
Posts: 439
|
|
"here object of type class will create on heap and p is a refrence now when we write objs.writeObject(p) in this case what will written to a file either object or refrence. " It writes the object to the file. Serialization means, storing the object into persistent storage area. For your first doubt, here is my understanding, - Serialization is writing the object to the ObjectOutputStream. - Writing to file is actually putting ObjectOutputStream containing object state to a file on the storage media. Anybody, pl. correct me if I am wrong. surya.
|
Sai Surya, SCJP 5.0, SCWCD 5.0, IBM 833 834
http://sai-surya-talk.blogspot.com, I believe in Murphy's law.
|
 |
Jeremy Botha
Ranch Hand
Joined: Feb 16, 2005
Posts: 125
|
|
Serialisation involves taking the contents (i,e the state variables) of an object and writing them out as an array of bytes. This array of bytes can then be 1) written to screen 2) written to file 3) written to the network 4) etc etc. Deserialisation is the process of taking a byte array which contains the state of a serialized object, and attempting to populate a new instance of that object type with the state of the original serialised object. Where and how the serialised object is stored is not in any part connected to Serialisation. Jeremy
|
McFinnigan? Never heard of him. Nobody here but us chickens...<br /> <br />SCJP for Java 1.4<br />SCJD for Java 5.0
|
 |
Arun Maalik
Ranch Hand
Joined: Oct 25, 2005
Posts: 216
|
|
Thank to Jermy Botha i undrstood what K&B wants to say. Now i have a bit of confusion that when i make state of variable as a transit then what happen with these variable.will these variable will taken in a array of byte or not , if taken then i think it will ignore at the moment of decerialisation. Am i right Jermy sir??? thanks Arun kumar maalik
|
 |
 |
|
|
subject: I am not getting K&B page 445
|
|
|