Class MarshalOutputStream
- All Implemented Interfaces:
Closeable,DataOutput,Flushable,ObjectOutput,ObjectStreamConstants,AutoCloseable
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).
- Since:
- 5.0
- Author:
- Igor Goldenberg, anna
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.io.ObjectOutputStream
ObjectOutputStream.PutField -
Field Summary
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, SERIAL_FILTER_PERMISSION, 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
ConstructorsConstructorDescriptionMarshalOutputStream(OutputStream out, boolean optimize) Creates a newMarshalOutputStreamthat writes marshalled data to the specified underlyingOutputStream.MarshalOutputStream(OutputStream out, MarshalOutputStream base) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidprotected voidwriteAnnotation(Class cl) First checks that this class wasn't written already, if it does do nothing.protected voidOverrides the original implementation, tries to save sending class descriptor, first checks if the class was already sent.voidWrites a repetitive object.voidprotected voidMethods inherited from class com.gigaspaces.internal.io.AnnotatedObjectOutputStream
annotateClass, annotateProxyClassMethods inherited from class java.io.ObjectOutputStream
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, writeUTFMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
MarshalOutputStream
- Throws:
IOException
-
MarshalOutputStream
Creates a newMarshalOutputStreamthat writes marshalled data to the specified underlyingOutputStream.This constructor passes
outto the superclass constructor that has anOutputStreamparameter.- Parameters:
out- the output stream to write marshalled data tooptimize- whether to activate the class description optimization during serialization.- Throws:
IOException- if the superclass's constructor throws anIOExceptionSecurityException- if the superclass's constructor throws aSecurityException
-
MarshalOutputStream
- Throws:
IOException
-
-
Method Details
-
writeRepetitiveObject
Writes a repetitive object. If this is the first time this object is written, it is assigned a code which is written along the object. The next time the object is written using this method, only its code is written. NOTE: Objects written using this method are cached and are NEVER cleaned up. If the object you are writing is using a PU resource it will not be released when the PU is terminated, and will cause a leak.- Throws:
IOException
-
writeSmartExternalizable
- Throws:
IOException
-
writeAnnotation
First checks that this class wasn't written already, if it does do nothing.Else invokes
RMIClassLoader.getClassAnnotationwithclto get the appropriate class annotation string value (possiblynull) and then writes a class annotation string value (possiblynull) to be read by a correspondingMarshalInputStreamimplementation.MarshalOutputStreamimplements this method to just write the annotation value to this stream usingwriteUnshared.A subclass can override this method to write the annotation to a different location.
- Overrides:
writeAnnotationin classAnnotatedObjectOutputStream- Parameters:
cl- the class annotation string value (possiblynull) to write- Throws:
IOException- if I/O exception occurs writing the annotation
-
writeClassDescriptor
Overrides the original implementation, tries to save sending class descriptor, first checks if the class was already sent. If it does send only the class index otherwise send the class descriptor also.- Overrides:
writeClassDescriptorin classObjectOutputStream- Parameters:
desc- class descriptor to write to the stream.- Throws:
IOException- If an I/O error has occurred.
-
writeStreamHeader
- Overrides:
writeStreamHeaderin classObjectOutputStream- Throws:
IOException
-
closeContext
public void closeContext() -
resetContext
public void resetContext()
-