public class MarshalOutputStream extends AnnotatedObjectOutputStream
ObjectOutputStream
that implements the dynamic class loading
semantics of RMI argument and result marshalling (using RMIClassLoader
). A
MarshalOutputStream
writes data that is intended to be written by a corresponding
MarshalInputStream
.
MarshalOutputStream
implements the output side of the dynamic class loading
semantics by overriding annotateClass
and annotateProxyClass
to annotate class descriptors in the
stream with codebase strings obtained using RMIClassLoader.getClassAnnotation
.
MarshalOutputStream
writes class annotations to its own stream; a subclass may
override the writeAnnotation
method to write the class annotations to a
different location.
MarshalOutputStream
does not modify the stream protocol version of its instances'
superclass state (see ObjectOutputStream.useProtocolVersion
).
Modifier and Type | Class and Description |
---|---|
static class |
MarshalOutputStream.Context |
ObjectOutputStream.PutField
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 |
---|
MarshalOutputStream(OutputStream out) |
MarshalOutputStream(OutputStream out,
boolean optimize)
Creates a new
MarshalOutputStream that writes marshalled data to the specified
underlying OutputStream . |
MarshalOutputStream(OutputStream out,
MarshalOutputStream base) |
Modifier and Type | Method and Description |
---|---|
void |
closeContext() |
void |
resetContext() |
protected void |
writeAnnotation(Class cl)
First checks that this class wasn't written already, if it does do nothing.
|
protected void |
writeClassDescriptor(ObjectStreamClass desc)
Overrides the original implementation, tries to save sending class descriptor, first checks
if the class was already sent.
|
void |
writeRepetitiveObject(Object obj)
Writes a repetitive object.
|
void |
writeSmartExternalizable(SmartExternalizable obj) |
protected void |
writeStreamHeader() |
annotateClass, annotateProxyClass
close, defaultWriteObject, drain, enableReplaceObject, flush, putFields, replaceObject, reset, useProtocolVersion, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFields, writeFloat, writeInt, writeLong, writeObject, writeObjectOverride, writeShort, writeUnshared, writeUTF
public MarshalOutputStream(OutputStream out) throws IOException
IOException
public MarshalOutputStream(OutputStream out, boolean optimize) throws IOException
MarshalOutputStream
that writes marshalled data to the specified
underlying OutputStream
.
This constructor passes out
to the superclass constructor that has an
OutputStream
parameter.
out
- the output stream to write marshalled data tooptimize
- whether to activate the class description optimization during serialization.IOException
- if the superclass's constructor throws an IOException
SecurityException
- if the superclass's constructor throws a SecurityException
public MarshalOutputStream(OutputStream out, MarshalOutputStream base) throws IOException
IOException
public void writeRepetitiveObject(Object obj) throws IOException
IOException
public void writeSmartExternalizable(SmartExternalizable obj) throws IOException
IOException
protected void writeAnnotation(Class cl) throws IOException
Else invokes RMIClassLoader.getClassAnnotation
with cl
to get the appropriate class annotation string value (possibly
null
) and then writes a class annotation string value (possibly
null
) to be read by a corresponding MarshalInputStream
implementation.
MarshalOutputStream
implements this method to just write the annotation value
to this stream using writeUnshared
.
A subclass can override this method to write the annotation to a different location.
writeAnnotation
in class AnnotatedObjectOutputStream
cl
- the class annotation string value (possibly null
) to writeIOException
- if I/O exception occurs writing the annotationprotected void writeClassDescriptor(ObjectStreamClass desc) throws IOException
writeClassDescriptor
in class ObjectOutputStream
desc
- class descriptor to write to the stream.IOException
- If an I/O error has occurred.protected void writeStreamHeader() throws IOException
writeStreamHeader
in class ObjectOutputStream
IOException
public void closeContext()
public void resetContext()
Copyright © GigaSpaces.