org.apache.geronimo.messaging.io
Class StreamInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.ObjectInputStream
          extended byorg.apache.geronimo.messaging.io.StreamInputStream
All Implemented Interfaces:
DataInput, ObjectInput, ObjectStreamConstants

public class StreamInputStream
extends ObjectInputStream

Allows to read an InputStream from the underlying InputStream. More accurately, it allows retrieving the InputStream identifier encoded in the underlying InputStream. This identifier is then passed to the StreamManager, which returns the InputStream having the provided identifier.

Version:
$Revision: 1.1 $ $Date: 2004/05/11 12:06:41 $

Nested Class Summary
 
Nested classes inherited from class java.io.ObjectInputStream
ObjectInputStream.GetField
 
Field Summary
 
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
StreamInputStream(InputStream anIn, StreamManager aManager, ReplacerResolver aResolver)
          Creates an InputStream operating on the provided InputStream and using the provided StreamManager to retrieve encoded InputStream.
 
Method Summary
protected  ObjectStreamClass readClassDescriptor()
          Counterpart of StreamOutputStream.writeClassDescriptor.
 InputStream readStream()
          Reads the InputStream identifier encoded in the underlying InputStream and returns the InputStream having this identifier and registered by the StreamManager.
protected  void readStreamHeader()
          It is critical to read nothing during the creation of ObjectInputStream.
protected  Object resolveObject(Object obj)
           
 
Methods inherited from class java.io.ObjectInputStream
available, close, defaultReadObject, enableResolveObject, read, read, readBoolean, readByte, readChar, readDouble, readFields, readFloat, readFully, readFully, readInt, readLine, readLong, readObject, readObjectOverride, readShort, readUnshared, readUnsignedByte, readUnsignedShort, readUTF, registerValidation, resolveClass, resolveProxyClass, skipBytes
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.ObjectInput
read, skip
 

Constructor Detail

StreamInputStream

public StreamInputStream(InputStream anIn,
                         StreamManager aManager,
                         ReplacerResolver aResolver)
                  throws IOException
Creates an InputStream operating on the provided InputStream and using the provided StreamManager to retrieve encoded InputStream.

Parameters:
anIn - InpuStream to be read from.
aManager - StreamManager.
aResolver - Used to resolveObject.
Throws:
IOException - If an I/O error has occured.
Method Detail

readStream

public InputStream readStream()
                       throws IOException
Reads the InputStream identifier encoded in the underlying InputStream and returns the InputStream having this identifier and registered by the StreamManager.

Returns:
InputStream encoded in the underlying InputStream.
Throws:
IOException - May indicates that the StreamManager does not know about the encoded identifer.

readStreamHeader

protected void readStreamHeader()
                         throws IOException,
                                StreamCorruptedException
It is critical to read nothing during the creation of ObjectInputStream.
Indeed, StreamInputStream and StreamOutputStream are used by StreamInInterceptor and StreamOutInterceptor respectively. It should be possible to instantiate these two objects at the same time, for instance to wrap the InputStream and OutputStream of a Socket.
If ObjectInputStream reads a StreamHeader during its creation, then it is not possible to create these two classes at the same time.

Throws:
IOException
StreamCorruptedException

readClassDescriptor

protected ObjectStreamClass readClassDescriptor()
                                         throws IOException,
                                                ClassNotFoundException
Counterpart of StreamOutputStream.writeClassDescriptor.

Throws:
IOException
ClassNotFoundException

resolveObject

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


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