uka.transport
Class DeepClone.CopyMarshalStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.ObjectOutputStream
          extended byuka.transport.DeepClone.CopyMarshalStream
All Implemented Interfaces:
java.io.DataOutput, java.io.ObjectOutput, java.io.ObjectStreamConstants
Enclosing class:
DeepClone

final class DeepClone.CopyMarshalStream
extends java.io.ObjectOutputStream


Nested Class Summary
 
Nested classes inherited from class java.io.ObjectOutputStream
java.io.ObjectOutputStream.PutField
 
Field Summary
 
Fields inherited from class java.io.ObjectOutputStream
 
Fields inherited from interface java.io.ObjectStreamConstants
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING
 
Constructor Summary
DeepClone.CopyMarshalStream(java.io.OutputStream outputstream)
           
 
Method Summary
protected  java.lang.Object replaceObject(java.lang.Object orig)
          Inspects each object of an object graph that is written to the DeepClone.CopyMarshalStream.
protected  void writeStreamHeader()
          Do not write a stream header.
 
Methods inherited from class java.io.ObjectOutputStream
annotateClass, annotateProxyClass, close, defaultWriteObject, drain, enableReplaceObject, flush, putFields, reset, useProtocolVersion, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeClassDescriptor, writeDouble, writeFields, writeFloat, writeInt, writeLong, writeObject, writeObjectOverride, writeShort, writeUnshared, writeUTF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeepClone.CopyMarshalStream

public DeepClone.CopyMarshalStream(java.io.OutputStream outputstream)
                            throws java.io.IOException
Method Detail

writeStreamHeader

protected void writeStreamHeader()
                          throws java.io.IOException
Do not write a stream header.

Throws:
java.io.IOException

replaceObject

protected java.lang.Object replaceObject(java.lang.Object orig)
                                  throws java.io.IOException
Inspects each object of an object graph that is written to the DeepClone.CopyMarshalStream. Objects that are cloned using marshaling/unmarshaling are nevertheless entered in the DeepClone.originals space with the following trick: During the marshaling process, each marshaled object is presented to this method. It assigns an identifier, but can not yet enter the copy into the DeepClone.copies space. Unfortunately, the objects that are read back are presented to the DeepClone.CopyUnmarshalStream.resolveObject(Object) method in dept-first postorder, while the originals were presented in depth-first preorder. Therefore DeepClone.CopyUnmarshalStream.resolveObject(Object) can not enter the copies to the DeepClone.copies space. Entering the copies is therefore done in a postprocessing step, by marshaling again all objects entered into DeepClone.streamCopyIDs, and reading back their copies in the same order.

Throws:
java.io.IOException
See Also:
DeepClone.streamCopyIDs