• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I am not getting K&B page 445

 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 463
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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.
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic