ch.ethz.iks.util
Class SmartObjectOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ObjectOutputStream
          extended by ch.ethz.iks.util.SmartObjectOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.DataOutput, java.io.Flushable, java.io.ObjectOutput, java.io.ObjectStreamConstants

public final class SmartObjectOutputStream
extends java.io.ObjectOutputStream

Smart object output 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.ObjectOutputStream
java.io.ObjectOutputStream.PutField
 
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
SmartObjectOutputStream(java.io.OutputStream out)
           
 
Method Summary
 void close()
           
 void flush()
           
 void reset()
           
 void write(byte[] buf)
           
 void write(byte[] buf, int off, int len)
           
 void write(int val)
           
 void writeBoolean(boolean val)
           
 void writeByte(int val)
           
 void writeBytes(java.lang.String str)
           
 void writeChar(int val)
           
 void writeChars(java.lang.String str)
           
 void writeDouble(double val)
           
 void writeFloat(float val)
           
 void writeInt(int val)
           
 void writeLong(long val)
           
protected  void writeObjectOverride(java.lang.Object o)
           
 void writeShort(int val)
           
 void writeUTF(java.lang.String str)
           
 
Methods inherited from class java.io.ObjectOutputStream
annotateClass, annotateProxyClass, defaultWriteObject, drain, enableReplaceObject, putFields, replaceObject, useProtocolVersion, writeClassDescriptor, writeFields, writeObject, writeStreamHeader, writeUnshared
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmartObjectOutputStream

public SmartObjectOutputStream(java.io.OutputStream out)
                        throws java.io.IOException
Throws:
java.io.IOException
Method Detail

writeObjectOverride

protected final void writeObjectOverride(java.lang.Object o)
                                  throws java.io.IOException
Overrides:
writeObjectOverride in class java.io.ObjectOutputStream
Throws:
java.io.IOException

write

public final void write(int val)
                 throws java.io.IOException
Specified by:
write in interface java.io.DataOutput
Specified by:
write in interface java.io.ObjectOutput
Overrides:
write in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.write(int)

write

public final void write(byte[] buf)
                 throws java.io.IOException
Specified by:
write in interface java.io.DataOutput
Specified by:
write in interface java.io.ObjectOutput
Overrides:
write in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.write(byte[])

write

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

flush

public final void flush()
                 throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Specified by:
flush in interface java.io.ObjectOutput
Overrides:
flush in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.flush()

reset

public final void reset()
                 throws java.io.IOException
Overrides:
reset in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.reset()

close

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

writeBoolean

public final void writeBoolean(boolean val)
                        throws java.io.IOException
Specified by:
writeBoolean in interface java.io.DataOutput
Overrides:
writeBoolean in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.writeBoolean(boolean)

writeByte

public final void writeByte(int val)
                     throws java.io.IOException
Specified by:
writeByte in interface java.io.DataOutput
Overrides:
writeByte in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.writeByte(int)

writeShort

public final void writeShort(int val)
                      throws java.io.IOException
Specified by:
writeShort in interface java.io.DataOutput
Overrides:
writeShort in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.writeShort(int)

writeChar

public final void writeChar(int val)
                     throws java.io.IOException
Specified by:
writeChar in interface java.io.DataOutput
Overrides:
writeChar in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.writeChar(int)

writeInt

public final void writeInt(int val)
                    throws java.io.IOException
Specified by:
writeInt in interface java.io.DataOutput
Overrides:
writeInt in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.writeInt(int)

writeLong

public final void writeLong(long val)
                     throws java.io.IOException
Specified by:
writeLong in interface java.io.DataOutput
Overrides:
writeLong in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.writeLong(long)

writeFloat

public final void writeFloat(float val)
                      throws java.io.IOException
Specified by:
writeFloat in interface java.io.DataOutput
Overrides:
writeFloat in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.writeFloat(float)

writeDouble

public final void writeDouble(double val)
                       throws java.io.IOException
Specified by:
writeDouble in interface java.io.DataOutput
Overrides:
writeDouble in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.writeDouble(double)

writeBytes

public final void writeBytes(java.lang.String str)
                      throws java.io.IOException
Specified by:
writeBytes in interface java.io.DataOutput
Overrides:
writeBytes in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.writeBytes(java.lang.String)

writeChars

public final void writeChars(java.lang.String str)
                      throws java.io.IOException
Specified by:
writeChars in interface java.io.DataOutput
Overrides:
writeChars in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.writeChars(java.lang.String)

writeUTF

public final void writeUTF(java.lang.String str)
                    throws java.io.IOException
Specified by:
writeUTF in interface java.io.DataOutput
Overrides:
writeUTF in class java.io.ObjectOutputStream
Throws:
java.io.IOException
See Also:
ObjectOutputStream.writeUTF(java.lang.String)


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