commonj.sdo.impl
Class ExternalizableDelegator

java.lang.Object
  extended by commonj.sdo.impl.ExternalizableDelegator
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class ExternalizableDelegator
extends java.lang.Object
implements java.io.Externalizable

Delegates DataObject serialization while ensuring implementation independent java.io.Serialization. An implementation of DataObject returns an ExternalizableDelegator from its writeReplace() method. The root DataObject is the object returned from do.getRootObject() where do is the DataObject being serialized in a java.io.ObjectOutputStream. When do.getContainer() == null then do is a root object. The byte format for each DataObject in the stream is: [0] [path] [root] // when do is not a root object [1] [rootXML] // when do is a root object where: [0] is the byte 0, serialized using writeByte(0). [1] is the byte 1, serialized using writeByte(1). [path] is an SDO path expression from the root DataObject to the serialized DataObject such that root.getDataObject(path) == do. Serialized using writeUTF(path). [root] is the root object serialized using writeObject(root). [rootXML] is the GZip of the XML serialization of the root DataObject. The XML serialization is the same as XMLHelper.INSTANCE.save(root, "commonj.sdo", "dataObject", stream); where stream is a GZIPOutputStream, length is the number of bytes in the stream, and bytes are the contents of the stream. Serialized using writeInt(length), write(bytes).

See Also:
Serialized Form

Nested Class Summary
static interface ExternalizableDelegator.Resolvable
           
 
Constructor Summary
ExternalizableDelegator()
           
ExternalizableDelegator(java.lang.Object target)
           
 
Method Summary
 void readExternal(java.io.ObjectInput in)
           
 java.lang.Object readResolve()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalizableDelegator

public ExternalizableDelegator()

ExternalizableDelegator

public ExternalizableDelegator(java.lang.Object target)
Method Detail

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

readResolve

public java.lang.Object readResolve()
                             throws java.io.ObjectStreamException
Throws:
java.io.ObjectStreamException


Copyright © 2007. All Rights Reserved.