org.objectweb.jac.core
Class JacObjectOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.ObjectOutputStream
              |
              +--org.objectweb.jac.core.JacObjectOutputStream
All Implemented Interfaces:
DataOutput, ObjectOutput, ObjectStreamConstants

public class JacObjectOutputStream
extends ObjectOutputStream

JacObjectOutputStream is used to write JAC objects into an output stream during a serialization process.

This stream is used when serializing a JAC object into an array of bytes when calling JacObject.serialize(). All the objects that are not JAC objects are serialized with the default procedure. When a JAC object is encountered, a whenSerialized event is thrown on the current AC manager so that the aspect components can parametrize the serialization process.

A symetric process for deserialization is implemented by JacObjectInputStream.

Author:
Renaud Pawlak, Lionel Seinturier
See Also:
ACManager.whenSerialized(Wrappee,SerializedJacObject), JacObjectInputStream

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
JacObjectOutputStream(OutputStream os)
          Creates a JacObjectInputStream.
 
Method Summary
protected  Object replaceObject(Object obj)
          This method is upcalled by the Java serialization process each time a new object to serialize is encountered.
 
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, writeClassDescriptor, writeDouble, writeFields, writeFloat, writeInt, writeLong, writeObject, writeObjectOverride, writeShort, writeStreamHeader, writeUnshared, writeUTF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JacObjectOutputStream

public JacObjectOutputStream(OutputStream os)
                      throws IOException
Creates a JacObjectInputStream.

Parameters:
os - the output stream where the bytes are written.
Method Detail

replaceObject

protected Object replaceObject(Object obj)
                        throws IOException
This method is upcalled by the Java serialization process each time a new object to serialize is encountered.

If a JAC object is encountered (instance of Wrappee), the aspect component manager is upcalled to parametrize the serialization.

Overrides:
replaceObject in class ObjectOutputStream
Parameters:
obj - the encountered JAC object
Returns:
the final serialized JAC object
IOException
See Also:
SerializedJacObject, ACManager.whenSerialized(Wrappee,SerializedJacObject)