public class RMIObjectOutputStream extends 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.ObjectOutputStream.PutFieldbaseWireHandle, 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(OutputStream out)
Constructs a new RMIObjectOutputStream that writes to the given
OutputStream. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
annotateClass(Class cl)
Implementation of the
ObjectOutputStream.annotateClass(Class) callback. |
protected void |
annotateProxyClass(Class cl)
Implementation of the
ObjectOutputStream.annotateProxyClass(Class cl) callback. |
protected Object |
replaceObject(Object obj)
Implementation of the
ObjectOutputStream.replaceObject(Object) callback. |
protected void |
writeClassDescriptor(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, writeUTFpublic RMIObjectOutputStream(OutputStream out) throws IOException
OutputStream.out - the OutputStream to use for outputIOExceptionprotected void annotateClass(Class cl) throws IOException
ObjectOutputStream.annotateClass(Class) callback. This
implementation delegates to RMIClassLoader.annotateClass in class ObjectOutputStreamcl - the Class to annotateIOException - when there is an error with the underlying
streamprotected void annotateProxyClass(Class cl) throws IOException
ObjectOutputStream.annotateProxyClass(Class cl) callback. This
implementation defers to annotateClass(Class).annotateProxyClass in class ObjectOutputStreamcl - the Class to annotateIOException - when there is an error with the underlying
streamprotected Object replaceObject(Object obj)
ObjectOutputStream.replaceObject(Object) callback. This
implementation converts Remote objects to stubs if necessary.replaceObject in class ObjectOutputStreamobj - the object being considered for serializationprotected void writeClassDescriptor(ObjectStreamClass desc) throws 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 ObjectOutputStreamdesc - the ObjectStreamClass to writeIOException - 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 ObjectOutputStream