com.ibm.aglets
Class AgletInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.ObjectInputStream
          extended bycom.ibm.aglets.AgletInputStream
All Implemented Interfaces:
java.io.DataInput, java.io.ObjectInput, java.io.ObjectStreamConstants

final class AgletInputStream
extends java.io.ObjectInputStream

An instance of this class reads objects from an input stream which contains class data with objects. The input stream contains objects, class data of these objects and class data of all super classes of these classes. Data in the input stream must be written by an instance of the AgletOutputStream.

This aglet input stream looks into the class loader cache of the AgletLoader and gets a class loader corresponding to the URL of an origin of the received class. If the class loader is not found in the cache, this stream will creates a new class loader and put it into the cache. After getting the class loader, this stream gets a class of the received object from the class cache of the class loader. If the class is not found in the class cache, the class loader will create the class.

Version:
1.00 96/06/28
Author:
Gaku Yamamoto, Mitsuru Oshima
See Also:
AgletOutputStream, AgletLoader

Nested Class Summary
 
Nested classes inherited from class java.io.ObjectInputStream
java.io.ObjectInputStream.GetField
 
Field Summary
private  ResourceManager rm
           
 
Fields inherited from class java.io.ObjectInputStream
 
Fields inherited from class java.io.InputStream
 
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
AgletInputStream(java.io.InputStream in, ResourceManager rm)
          Create a new instance of this class.
 
Method Summary
protected  void readStreamHeader()
           
 java.lang.Class resolveClass(java.io.ObjectStreamClass classinfo)
          Resolve a class specified by classname.
 
Methods inherited from class java.io.ObjectInputStream
available, close, defaultReadObject, enableResolveObject, read, read, readBoolean, readByte, readChar, readClassDescriptor, readDouble, readFields, readFloat, readFully, readFully, readInt, readLine, readLong, readObject, readObjectOverride, readShort, readUnshared, readUnsignedByte, readUnsignedShort, readUTF, registerValidation, resolveObject, 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
 

Field Detail

rm

private ResourceManager rm
Constructor Detail

AgletInputStream

public AgletInputStream(java.io.InputStream in,
                        ResourceManager rm)
                 throws java.io.IOException
Create a new instance of this class.

Parameters:
in - an input stream containing objests and class data.
Throws:
java.io.IOException - if can not read data from the input stream.
java.io.StreamCorruptedException - if data in the input stream is invalid.
Method Detail

readStreamHeader

protected void readStreamHeader()
                         throws java.io.IOException,
                                java.io.StreamCorruptedException
Throws:
java.io.IOException
java.io.StreamCorruptedException

resolveClass

public java.lang.Class resolveClass(java.io.ObjectStreamClass classinfo)
                             throws java.io.IOException,
                                    java.lang.ClassNotFoundException
Resolve a class specified by classname. This method reads class data from the input stream and resolves the class by using a class loader corresponding to the origin of the class. If the class is common class, the class will be resolved by super.resolveClass. This method reads class data of all super classes of the class in the input stream and put them into the class data cache of the class loader. These super classes will be resolved on demand.

Returns:
the resolved class.
Throws:
java.io.IOException - if can not read data from the input stream.
java.lang.ClassNotFoundException - if can not resolve the class.