ch.ethz.iks.util
Class SmartObjectInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.ObjectInputStream
          extended by ch.ethz.iks.util.SmartObjectInputStream
All Implemented Interfaces:
java.io.Closeable, java.io.DataInput, java.io.ObjectInput, java.io.ObjectStreamConstants

public final class SmartObjectInputStream
extends java.io.ObjectInputStream

Smart object input stream that is able to deserialize classes which do not implement Serializable. It only rejects classes which have native code parts and the OSGi ServiceReference and ServiceRegistration classes.

Author:
Jan S. Rellermeyer

Nested Class Summary
 
Nested classes/interfaces inherited from class java.io.ObjectInputStream
java.io.ObjectInputStream.GetField
 
Field Summary
 
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
SmartObjectInputStream(java.io.InputStream in)
           
 
Method Summary
 int available()
           
 void close()
           
 int read()
           
 int read(byte[] buf, int off, int len)
           
 boolean readBoolean()
           
 byte readByte()
           
 char readChar()
           
 double readDouble()
           
 float readFloat()
           
 void readFully(byte[] buf)
           
 void readFully(byte[] buf, int off, int len)
           
 int readInt()
           
 java.lang.String readLine()
          Deprecated.  
 long readLong()
           
protected  java.lang.Object readObjectOverride()
           
 short readShort()
           
 int readUnsignedByte()
           
 int readUnsignedShort()
           
 java.lang.String readUTF()
           
 int skipBytes(int len)
           
 
Methods inherited from class java.io.ObjectInputStream
defaultReadObject, enableResolveObject, readClassDescriptor, readFields, readObject, readStreamHeader, readUnshared, registerValidation, resolveClass, resolveObject, resolveProxyClass
 
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

SmartObjectInputStream

public SmartObjectInputStream(java.io.InputStream in)
                       throws java.io.IOException
Throws:
java.io.IOException
Method Detail

readObjectOverride

protected final java.lang.Object readObjectOverride()
                                             throws java.io.IOException,
                                                    java.lang.ClassNotFoundException
Overrides:
readObjectOverride in class java.io.ObjectInputStream
Throws:
java.io.IOException
java.lang.ClassNotFoundException

read

public final int read()
               throws java.io.IOException
Specified by:
read in interface java.io.ObjectInput
Overrides:
read in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.read()

read

public final int read(byte[] buf,
                      int off,
                      int len)
               throws java.io.IOException
Specified by:
read in interface java.io.ObjectInput
Overrides:
read in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.read(byte[], int, int)

available

public final int available()
                    throws java.io.IOException
Specified by:
available in interface java.io.ObjectInput
Overrides:
available in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.available()

close

public final void close()
                 throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in interface java.io.ObjectInput
Overrides:
close in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.close()

readBoolean

public final boolean readBoolean()
                          throws java.io.IOException
Specified by:
readBoolean in interface java.io.DataInput
Overrides:
readBoolean in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readBoolean()

readByte

public final byte readByte()
                    throws java.io.IOException
Specified by:
readByte in interface java.io.DataInput
Overrides:
readByte in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readByte()

readUnsignedByte

public final int readUnsignedByte()
                           throws java.io.IOException
Specified by:
readUnsignedByte in interface java.io.DataInput
Overrides:
readUnsignedByte in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readUnsignedByte()

readChar

public final char readChar()
                    throws java.io.IOException
Specified by:
readChar in interface java.io.DataInput
Overrides:
readChar in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readChar()

readShort

public final short readShort()
                      throws java.io.IOException
Specified by:
readShort in interface java.io.DataInput
Overrides:
readShort in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readShort()

readUnsignedShort

public final int readUnsignedShort()
                            throws java.io.IOException
Specified by:
readUnsignedShort in interface java.io.DataInput
Overrides:
readUnsignedShort in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readUnsignedShort()

readInt

public final int readInt()
                  throws java.io.IOException
Specified by:
readInt in interface java.io.DataInput
Overrides:
readInt in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readInt()

readLong

public final long readLong()
                    throws java.io.IOException
Specified by:
readLong in interface java.io.DataInput
Overrides:
readLong in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readLong()

readFloat

public final float readFloat()
                      throws java.io.IOException
Specified by:
readFloat in interface java.io.DataInput
Overrides:
readFloat in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readFloat()

readDouble

public final double readDouble()
                        throws java.io.IOException
Specified by:
readDouble in interface java.io.DataInput
Overrides:
readDouble in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readDouble()

readFully

public final void readFully(byte[] buf)
                     throws java.io.IOException
Specified by:
readFully in interface java.io.DataInput
Overrides:
readFully in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readFully(byte[])

readFully

public final void readFully(byte[] buf,
                            int off,
                            int len)
                     throws java.io.IOException
Specified by:
readFully in interface java.io.DataInput
Overrides:
readFully in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readFully(byte[], int, int)

skipBytes

public final int skipBytes(int len)
                    throws java.io.IOException
Specified by:
skipBytes in interface java.io.DataInput
Overrides:
skipBytes in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.skipBytes(int)

readLine

public final java.lang.String readLine()
                                throws java.io.IOException
Deprecated. 

Specified by:
readLine in interface java.io.DataInput
Overrides:
readLine in class java.io.ObjectInputStream
Throws:
java.io.IOException

readUTF

public final java.lang.String readUTF()
                               throws java.io.IOException
Specified by:
readUTF in interface java.io.DataInput
Overrides:
readUTF in class java.io.ObjectInputStream
Throws:
java.io.IOException
See Also:
ObjectInputStream.readUTF()


Copyright © 2009 IKS, ETH Zurich. All Rights Reserved.