Java2 codes,problems ,discussions and solutions are here
Fri Oct 24, 2008 10:28 pm
I need a clear clarification on Externalization and Serialization.
What i heard from different forums is the following:-
->Externalization is customization of Serialization which provides two methods
readExternal() and writeExternal().
->If we want to forbid some variables in participating in serialization we
need to implement Externalizable and ovverride those two methods and serialize
only the required variables.
The statement marked in red can be achieved by simply marking the variables as
transient(which doesnot allow variables to participate in Serialization).
Please help me in understanding these two concepts.
Also,
1) Send me some links that clearily expalins these two concepts.
2) What are the actual differences between these two words.
3) Which provides good performance.
Fri Oct 24, 2008 10:29 pm
The follwing answer i took from a site but unfortunately they dint give any more
examples.
Sterilization is a process of converting state of an object to stream of bytes
that can be sent over network or can be stored in a file or in database to be
reconstructed into Object Later when required. Remember EJB spec, all EJB
(Session or Entity) implements Serializable interface indirectly, in case of
Statefull session bean it can be Passivated or Activated (Persisted by writing
it to file system or Database this is done by container).
Externalization is same as Sterilization except that WriteObject() and
ReadObject() method are called by JVM during sterilization an desterilization of
object. One thing you can do with Externalization is that you can store extra
information into object like STATIC variables and transient variables or you can
add more information if you have any business need. One good example is
compressing and uncompressing of data to send it through network or converting
one format to other like a BMP image to JPEG or GIF format.
Fri Oct 24, 2008 10:35 pm
You just ping the host name. you get the as same as below.
Pinging Yahoo.com [216.109.112.135] with 32 bytes .
There's a good example of that done in Java here:
- Code:
http://www.rgagnon.com/javadetails/java-0093.html
Topic Tags
Java Serialization
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.