How does serialization work

Showing Answers 1 - 25 of 25 Answers

Sanjay Pattnaik

  • Aug 5th, 2005
 

o Synchronisation work with locks. 
o There is one built-in lock per each java object 
o If one thread picks up the lock, no other thread 
can enter the synchronised code. 
o A method or a code block could be  
synchonized  

  Was this answer useful?  Yes

Sumit Sengar

  • Sep 9th, 2005
 

Serialization works by converting the object to be saved into a stream of bytes and writing it to a disk or a fille. 
 
ObjectOutputStream makes an object so that it can be converted as bytes and then it coonects to another stream FileOutputStream which makes bytes toi be wriiten to file. 
 
 
 

Alpa Sekhalia

  • Sep 15th, 2005
 

Basically Serialization is used to maintain the state of an object.

When a program reads or write an object from the input stream or to output stream an object must be serialized first, so that values of that object doesn't change.

Serialization is needed in Remote Method Invocation.

  Was this answer useful?  Yes

sarat

  • Sep 29th, 2005
 

serilization is nothing but save the object state in persistant media like databace,files,etc.

Tharani devi

  • Oct 6th, 2005
 

Serialization works by implementing java.io.serializable interface.Here the object form information is converted into stream form.It is mandatory to implement this interface while storing the data(information) into any persistance storage medium.

ram

  • Oct 14th, 2005
 

Serialization is the process of writing down the state of an object to a persistance storage media and most frequently it will be used in distributed systems to transfer object to remote jvm.At this is time the object state is serialized and sent to the remote jvm and at the remote side the object will be deserialized to get its state

Srinivas Rao

  • Jan 17th, 2006
 

Serialization is technique that writes the state of objects in to persistance stroage areas....

The Main use of this is nothing but transfering objects from one plce to another place (or) Globalize the object .....Means

if we want to transfer some data from one place to another place in the objects form ,this tecnique is used. Exactly we are not transfering the objects ,we just store the data of an object to persistance area.that Area will accessed by another objects which are using or need our object Data...

for Example in Ejb technolgy (Distributed Technology) objects refferences are passed to clients using Serialization technique only...,  

Arun Kantilal Rajput

  • Nov 22nd, 2006
 

serialization means writing object to secondary storage device

lets write one as follows.

class a{

String s;

a(){

s="hi";

}

}

now

create objectoutputstream object and give it to fileoutputstream with file name say "a.ser" (use writeObject() method)

if u check, the object state is written in this file.

now create object Inputstream object and give it to fileinputstream with file same name  "a.ser"(use readObject() method)

same object will be sent from device to console.

chow.

  Was this answer useful?  Yes

Ganesh

  • Jul 14th, 2007
 

Serialization is nothing but save the object state in persistant media like databace,files,etc.
Most frequently it will be used in distributed systems to transfer object to remote jvm.
At this is time the object state is serialized and sent to the remote jvm and at the remote side the object will be deserialized to get its state

Serialization is needed in Remote Method Invocation.

  Was this answer useful?  Yes

hariharanatha reddy.m.k

  • Oct 13th, 2007
 

Serialization is the process of writing the state of an object into stream. Stream is either input stream, or output stream.

  Was this answer useful?  Yes

tejpal

  • Nov 2nd, 2007
 

it converts data into the format which  can travel in different data sources.like network cable etc.........

  Was this answer useful?  Yes

sampra

  • Feb 14th, 2008
 

It convert data object into flat format and transfer it any other remote mechine by any medum and thn there reconstruction of object will be done

  Was this answer useful?  Yes

Sarje

  • Aug 28th, 2009
 

In serialization process first state of the object is written to the java.io.ObjectOutputStream using its writeObject() method.

Then this ObjectOutputStream writes the state of the object to the java.io.FileOutputStream (in case you want to write to a file) which saves the state (values) of the objcet to the file for which you have created FileOutputStream.

FileOutputStream fos = new FileOutputStream("MyFile.txt");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(new String("Ram");

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions