net.jini.io
Class MarshalledInstance.MarshalledInstanceOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ObjectOutputStream
          extended by net.jini.io.MarshalOutputStream
              extended by net.jini.io.MarshalledInstance.MarshalledInstanceOutputStream
All Implemented Interfaces:
Closeable, DataOutput, Flushable, ObjectOutput, ObjectStreamConstants, ObjectStreamContext
Enclosing class:
MarshalledInstance

private static class MarshalledInstance.MarshalledInstanceOutputStream
extends MarshalOutputStream

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

See Also:
MarshalledInstance.MarshalledInstanceInputStream

Nested Class Summary
 
Nested classes/interfaces 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 interface java.io.ObjectStreamConstants
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 Summary
MarshalledInstance.MarshalledInstanceOutputStream(OutputStream objOut, OutputStream locOut, Collection context)
          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()
           
 boolean hadAnnotations()
          Returns true if any non-null location annotations have been written to this stream.
protected  void writeAnnotation(String loc)
          Overrides MarshalOutputStream.writeAnnotation implementation to write annotations to the location stream.
 
Methods inherited from class net.jini.io.MarshalOutputStream
annotateClass, annotateProxyClass, getObjectStreamContext
 
Methods inherited from class java.io.ObjectOutputStream
close, defaultWriteObject, drain, enableReplaceObject, putFields, replaceObject, 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

MarshalledInstance.MarshalledInstanceOutputStream

public MarshalledInstance.MarshalledInstanceOutputStream(OutputStream objOut,
                                                         OutputStream locOut,
                                                         Collection context)
                                                  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.

Throws:
IOException
Method Detail

hadAnnotations

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


writeAnnotation

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

Overrides:
writeAnnotation in class MarshalOutputStream
Parameters:
loc - the class annotation string value (possibly null) to write
Throws:
IOException - if I/O exception occurs writing the annotation

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Specified by:
flush in interface ObjectOutput
Overrides:
flush in class ObjectOutputStream
Throws:
IOException


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.