java.rmi
Class MarshalledObject.MarshalledObjectOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.ObjectOutputStream
          extended bysun.rmi.server.MarshalOutputStream
              extended byjava.rmi.MarshalledObject.MarshalledObjectOutputStream
All Implemented Interfaces:
DataOutput, ObjectOutput, ObjectStreamConstants
Enclosing class:
MarshalledObject

private static class MarshalledObject.MarshalledObjectOutputStream
extends sun.rmi.server.MarshalOutputStream

This class is used to marshal objects for MarshalledObject. It places the location annotations to one side so that two MarshalledObjects can be compared for equality if they differ only in location annotations. Objects written using this stream should be read back from a MarshalledObjectInputStream.

See Also:
MarshalledObject, MarshalledObjectInputStream

Nested Class Summary
 
Nested classes inherited from class java.io.ObjectOutputStream
ObjectOutputStream.PutField
 
Field Summary
private  boolean hadAnnotations
          true if non-null annotations are written.
private  ObjectOutputStream locOut
          The stream on which location objects are written.
 
Fields inherited from class java.io.ObjectOutputStream
 
Fields inherited from interface java.io.ObjectStreamConstants
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, 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_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING
 
Constructor Summary
(package private) MarshalledObject.MarshalledObjectOutputStream(OutputStream objOut, OutputStream locOut)
          Creates a new MarshalledObjectOutputStream whose non-location bytes will be written to objOut and whose location annotations (if any) will be written to locOut.
 
Method Summary
 void flush()
          Flushes the stream.
(package private)  boolean hadAnnotations()
          Returns true if any non-null location annotations have been written to this stream.
protected  void writeLocation(String loc)
          Overrides MarshalOutputStream.writeLocation implementation to write annotations to the location stream.
 
Methods inherited from class sun.rmi.server.MarshalOutputStream
annotateClass, annotateProxyClass, replaceObject
 
Methods inherited from class java.io.ObjectOutputStream
close, defaultWriteObject, drain, enableReplaceObject, 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

locOut

private ObjectOutputStream locOut
The stream on which location objects are written.


hadAnnotations

private boolean hadAnnotations
true if non-null annotations are written.

Constructor Detail

MarshalledObject.MarshalledObjectOutputStream

MarshalledObject.MarshalledObjectOutputStream(OutputStream objOut,
                                              OutputStream locOut)
                                        throws IOException
Creates a new MarshalledObjectOutputStream whose non-location bytes will be written to objOut and whose location annotations (if any) will be written to locOut.

Method Detail

hadAnnotations

boolean hadAnnotations()
Returns true if any non-null location annotations have been written to this stream.


writeLocation

protected void writeLocation(String loc)
                      throws IOException
Overrides MarshalOutputStream.writeLocation implementation to write annotations to the location stream.

Throws:
IOException

flush

public void flush()
           throws IOException
Description copied from class: ObjectOutputStream
Flushes the stream. This will write any buffered output bytes and flush through to the underlying stream.

Specified by:
flush in interface ObjectOutput
Overrides:
flush in class ObjectOutputStream
Throws:
IOException - If an I/O error has occurred.