org.objectweb.fractal.rmi.io
Class RmiObjectOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.ObjectOutputStream
          extended byorg.objectweb.fractal.rmi.io.RmiObjectOutputStream
All Implemented Interfaces:
DataOutput, ObjectOutput, ObjectStreamConstants

public class RmiObjectOutputStream
extends ObjectOutputStream

An ObjectOutputStream that replaces interface references with Ref objects.


Nested Class Summary
 
Nested classes inherited from class java.io.ObjectOutputStream
ObjectOutputStream.PutField
 
Field Summary
protected  NamingContext domain
          The naming context used to export local interfaces, to make them remotely accessible.
 
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
RmiObjectOutputStream(OutputStream os, NamingContext domain)
          Constructs a new RmiObjectOutputStream.
 
Method Summary
protected  void annotateClass(Class cl)
           
protected  void drain()
          Drain any buffered data in this stream.
protected  Object replaceObject(Object obj)
          Replaces component interfaces with Ref objects.
 
Methods inherited from class java.io.ObjectOutputStream
annotateProxyClass, close, defaultWriteObject, enableReplaceObject, flush, putFields, reset, useProtocolVersion, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeClassDescriptor, writeDouble, writeFields, writeFloat, writeInt, writeLong, writeObject, writeObjectOverride, writeShort, writeStreamHeader, writeUnshared, writeUTF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

domain

protected NamingContext domain
The naming context used to export local interfaces, to make them remotely accessible.

Constructor Detail

RmiObjectOutputStream

public RmiObjectOutputStream(OutputStream os,
                             NamingContext domain)
                      throws IOException
Constructs a new RmiObjectOutputStream.

Parameters:
os - the underlying output stream.
domain - the naming context to be used to export local interface references, to make them remotely accessible.
Throws:
IOException - if the super constructor throws an exception.
Method Detail

replaceObject

protected Object replaceObject(Object obj)
                        throws IOException
Replaces component interfaces with Ref objects. If the given object is an Interface, two cases are possible. If the object is also a Reference, then it is replaced with a Ref object containing an encoded form of the identifier held by the Reference. If the object is not a Reference, then it is exported with domain, and replaced with a Ref object containing an encoded form of the Identifier returned by export.

Parameters:
obj - an object.
Returns:
a Ref object if obj is a component interface, or obj otherwise.
Throws:
IOException - if a component interface cannot be replaced with a Ref object.

annotateClass

protected void annotateClass(Class cl)
                      throws IOException
Throws:
IOException

drain

protected void drain()
              throws IOException
Drain any buffered data in this stream.

Throws:
IOException