org.objectweb.fractal.rmi.io
Class RmiObjectOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ObjectOutputStream
          extended by org.objectweb.fractal.rmi.io.RmiObjectOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.DataOutput, java.io.Flushable, java.io.ObjectOutput, java.io.ObjectStreamConstants

public class RmiObjectOutputStream
extends java.io.ObjectOutputStream

An ObjectOutputStream that replaces interface references with Ref objects.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.io.ObjectOutputStream
java.io.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_ENUM, 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_ENUM, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING
 
Constructor Summary
RmiObjectOutputStream(java.io.OutputStream os, NamingContext domain)
          Constructs a new RmiObjectOutputStream.
 
Method Summary
protected  void drain()
          Drain any buffered data in this stream.
protected  java.lang.Object replaceObject(java.lang.Object obj)
          Replaces component interfaces with Ref objects.
 
Methods inherited from class java.io.ObjectOutputStream
annotateClass, 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(java.io.OutputStream os,
                             NamingContext domain)
                      throws java.io.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:
java.io.IOException - if the super constructor throws an exception.
Method Detail

replaceObject

protected java.lang.Object replaceObject(java.lang.Object obj)
                                  throws java.io.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.

Overrides:
replaceObject in class java.io.ObjectOutputStream
Parameters:
obj - an object.
Returns:
a Ref object if obj is a component interface, or obj otherwise.
Throws:
java.io.IOException - if a component interface cannot be replaced with a Ref object.

drain

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

Overrides:
drain in class java.io.ObjectOutputStream
Throws:
java.io.IOException - if an IO exception occurs.


Copyright © 2008 OW2 Consortium. All Rights Reserved.