org.apache.geronimo.messaging.io
Class StreamOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.ObjectOutputStream
          extended byorg.apache.geronimo.messaging.io.StreamOutputStream
All Implemented Interfaces:
DataOutput, ObjectOutput, ObjectStreamConstants

public class StreamOutputStream
extends ObjectOutputStream

This is the counterpart of StreamInputStream.

Version:
$Revision: 1.3 $ $Date: 2004/06/10 23:05:36 $

Nested Class Summary
 
Nested classes inherited from class java.io.ObjectOutputStream
ObjectOutputStream.PutField
 
Field Summary
static byte CACHED
          First byte written by writeClassDescriptor to indicate that the ObjectStreamClass to be written has already been provided.
static byte NOT_CACHED
          First byte written by writeClassDescriptor to indicate that the ObjectStreamClass to be written is new.
 
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
StreamOutputStream(OutputStream anOut, StreamManager aManager, ReplacerResolver aResolver)
           
 
Method Summary
 StreamManager getStreamManager()
          Gets the StreamManager used to resolve InputStream identifiers.
protected  Object replaceObject(Object obj)
           
protected  void writeClassDescriptor(ObjectStreamClass desc)
          ObjectStreamClasses are not systematically written to the stream.
 void writeStream(InputStream aStream)
           
protected  void writeStreamHeader()
          It is critical to avoid to write
 
Methods inherited from class java.io.ObjectOutputStream
annotateClass, annotateProxyClass, 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, writeUTF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_CACHED

public static final byte NOT_CACHED
First byte written by writeClassDescriptor to indicate that the ObjectStreamClass to be written is new.
StreamOutputStream writes just after this byte an int, which will be used subsequently to send the same ObjectStreamClass (having the same SUID).
After this identifier, the actual ObjectStreamClass is written.

See Also:
Constant Field Values

CACHED

public static final byte CACHED
First byte written by writeClassDescriptor to indicate that the ObjectStreamClass to be written has already been provided.
StreamOutputStream writes just after this byte an int, which is the identifier of the ObjectStreamClass being written.\
See NOT_CACHED for more details.

See Also:
Constant Field Values
Constructor Detail

StreamOutputStream

public StreamOutputStream(OutputStream anOut,
                          StreamManager aManager,
                          ReplacerResolver aResolver)
                   throws IOException
Method Detail

writeStream

public void writeStream(InputStream aStream)
                 throws IOException
Throws:
IOException

getStreamManager

public StreamManager getStreamManager()
Gets the StreamManager used to resolve InputStream identifiers.

Returns:
StreamManager.

writeStreamHeader

protected void writeStreamHeader()
                          throws IOException
It is critical to avoid to write

Throws:
IOException

writeClassDescriptor

protected void writeClassDescriptor(ObjectStreamClass desc)
                             throws IOException
ObjectStreamClasses are not systematically written to the stream. Instead, the very first time that a given ObjectStreamClass needs to be written, this implementation assigns it an identifier.
This latter will be written for all the remaining requests.

Parameters:
desc - Class description to be written to the stream.
Throws:
IOException

replaceObject

protected Object replaceObject(Object obj)
                        throws IOException
Throws:
IOException


Copyright © 2003-2005 Apache Software Foundation. All Rights Reserved.