The Artima Developer Community
Sponsored Link

Java Answers Forum
serialization

5 replies on 1 page. Most recent reply: Sep 18, 2003 3:52 AM by Senthoorkumaran Punniamoorthy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
Leela

Posts: 16
Nickname: leee
Registered: Sep, 2003

serialization Posted: Sep 16, 2003 6:39 AM
Reply to this message Reply
Advertisement
i need to know, what exactly object serialization means and where should it be used and where not???


David

Posts: 150
Nickname: archangel
Registered: Jul, 2003

Re: serialization Posted: Sep 16, 2003 7:14 AM
Reply to this message Reply
It's the creation of a persistent version of an object(s) which may be stored in, for example, a file.

mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: serialization Posted: Sep 16, 2003 7:58 AM
Reply to this message Reply
http://www.javacaps.com/java_serial.html

http://developer.java.sun.com/developer/technicalArticles/ALT/serialization/

Serializing an object involves encoding its state in a structured way within a byte array. Once an object is serialized, the byte array can be manipulated in various ways; it can be written to a file, sent over a network using a socket-based connection or RMI, or persisted within a database as a BLOB.
The serialization process encodes enough information about the object type within the byte stream, allowing the original object to be easily recreated upon deserialization, at a later point in time.

Leela

Posts: 16
Nickname: leee
Registered: Sep, 2003

Re: serialization Posted: Sep 17, 2003 11:16 PM
Reply to this message Reply
But, cant the objects be directly written to and read from the file using ObjectInputStream and ObjectOutputStream???

David

Posts: 150
Nickname: archangel
Registered: Jul, 2003

Re: serialization Posted: Sep 18, 2003 12:31 AM
Reply to this message Reply
What made you think that ObjectInputStream and ObjectOutputStream weren't anything to do with Serialization?

From the ObjectOutputStream API:

"An ObjectOutputStream writes primitive data types and graphs of Java objects to an OutputStream. The objects can be read (reconstituted) using an ObjectInputStream. Persistent storage of objects can be accomplished by using a file for the stream. If the stream is a network socket stream, the objects can be reconsituted on another host or in another process."

"Only objects that support the java.io.Serializable interface can be written to streams. The class of each serializable object is encoded including the class name and signature of the class, the values of the object's fields and arrays, and the closure of any other objects referenced from the initial objects."

http://java.sun.com/j2se/1.3/docs/api/java/io/ObjectOutputStream.html

Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: serialization Posted: Sep 18, 2003 3:52 AM
Reply to this message Reply
Leela,

Thats posible, however only requirement is that object being written should implement java.io.Serializable interface

Flat View: This topic has 5 replies on 1 page
Topic: char problem Previous Topic   Next Topic Topic: Help on reading html files

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use