public class RMIObjectOutputStream
extends java.io.ObjectOutputStream
RMIObjectInputStream
. Specialized behavior
includes class annotation using RMIClassLoader
, automatic
conversion of Remote objects to stubs, caching of class descriptors
accross calls to ObjectOutputStream.reset()
, and output buffering.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 and Description |
---|
RMIObjectOutputStream(java.io.OutputStream out)
Constructs a new RMIObjectOutputStream that writes to the given
OutputStream . |
Modifier and Type | Method and Description |
---|---|
protected void |
annotateClass(java.lang.Class cl)
Implementation of the
ObjectOutputStream.annotateClass(Class) callback. |
protected void |
annotateProxyClass(java.lang.Class cl)
Implementation of the
ObjectOutputStream.annotateProxyClass(Class cl) callback. |
protected java.lang.Object |
replaceObject(java.lang.Object obj)
Implementation of the
ObjectOutputStream.replaceObject(Object) callback. |
protected void |
writeClassDescriptor(java.io.ObjectStreamClass desc)
Implementation of the
ObjectOutputStream.writeClassDescriptor(ObjectStreamClass)
callback. |
protected void |
writeStreamHeader()
Implementation of the
ObjectOutputStream.writeStreamHeader() callback. |
close, defaultWriteObject, drain, enableReplaceObject, flush, putFields, reset, useProtocolVersion, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFields, writeFloat, writeInt, writeLong, writeObject, writeObjectOverride, writeShort, writeUnshared, writeUTF
public RMIObjectOutputStream(java.io.OutputStream out) throws java.io.IOException
OutputStream
.out
- the OutputStream
to use for outputjava.io.IOException
protected void annotateClass(java.lang.Class cl) throws java.io.IOException
ObjectOutputStream.annotateClass(Class)
callback. This
implementation delegates to RMIClassLoader
.annotateClass
in class java.io.ObjectOutputStream
cl
- the Class
to annotatejava.io.IOException
- when there is an error with the underlying
streamprotected void annotateProxyClass(java.lang.Class cl) throws java.io.IOException
ObjectOutputStream.annotateProxyClass(Class cl)
callback. This
implementation defers to annotateClass(Class)
.annotateProxyClass
in class java.io.ObjectOutputStream
cl
- the Class
to annotatejava.io.IOException
- when there is an error with the underlying
streamprotected java.lang.Object replaceObject(java.lang.Object obj)
ObjectOutputStream.replaceObject(Object)
callback. This
implementation converts Remote objects to stubs if necessary.replaceObject
in class java.io.ObjectOutputStream
obj
- the object being considered for serializationprotected void writeClassDescriptor(java.io.ObjectStreamClass desc) throws java.io.IOException
ObjectOutputStream.writeClassDescriptor(ObjectStreamClass)
callback. This implementation delegates to the superclass if
this descripter has not already been written to the output
stream, otherwise it sends an integer id referencing the
previously written class.writeClassDescriptor
in class java.io.ObjectOutputStream
desc
- the ObjectStreamClass
to writejava.io.IOException
- if there is an error with the underlying
streamprotected void writeStreamHeader()
ObjectOutputStream.writeStreamHeader()
callback. This
implementation is specifically overriden to do nothing because
both the ObjectOutputStream.writeStreamHeader()
and
ObjectInputStream.readStreamHeader()
callbacks
are invoked from each class' respective constructor. This
introduces a potentially non obvious side effect when
constructing new stream objects in a client server context
since the ObjectInputStream
constructor will
block waiting for input and this can cause deadlock if the
ObjectInputStream
is constructed first on both
the client and server ends.writeStreamHeader
in class java.io.ObjectOutputStream