How does serialization work.......!!

As Serializable interface is an MARKER interface and does not have any methods or field. Then how does a class implementing Serializable interface is automatically serialized(or the object is converted into bytestream).

Is it that, JVM does know what to do with a serialized object.

If this is the case, can I have a MARKER interface of my own, for a particular functionality.

with regards,

SHIRISH

[432 byte] By [Sunnie_200210324a] at [2007-11-27 10:20:37]
# 1

Yes. You can just use 'instanceof' to identify objects that implement your marker interface.

ejpa at 2007-7-28 17:04:44 > top of Java-index,Core,Core APIs...
# 2

> As Serializable interface is an MARKER interface and

> does not have any methods or field. Then how does a

> class implementing Serializable interface is

> automatically serialized(or the object is converted

> into bytestream).

They are not serialized automatically. There are methods available for that - ObjectInputStream.readObject() and ObjectOutputStream.writeObject().

aniseeda at 2007-7-28 17:04:44 > top of Java-index,Core,Core APIs...
# 3

marker interface definition

http://en.wikipedia.org/wiki/Marker_interface_pattern

interesting blog about why annotations are better suited

http://www.artima.com/weblogs/viewpost.jsp?thread=98061

developer_jbsa at 2007-7-28 17:04:44 > top of Java-index,Core,Core APIs...