Package org.jcsp.net
Class SerializedObject
- java.lang.Object
-
- org.jcsp.net.SerializedObject
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable
class SerializedObject extends java.lang.Object implements java.io.Externalizable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSerializedObject.AccesibleByteArrayOutputStreamThis class exists purely for performance reasons.private classSerializedObject.BasicInputStreamFactoryprivate static classSerializedObject.ExtClassThis class exists because the main class cannot have a no-arg constructor as required by externalizable.static interfaceSerializedObject.InputStreamFactory
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringobjectToStringprivate byte[]serializedData
-
Constructor Summary
Constructors Constructor Description SerializedObject(byte[] data, java.lang.String objectToString)A private constructor used during the deserialization process of this object.SerializedObject(java.lang.Object obj, boolean storeToString)This is the public used constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectget()java.lang.Objectget(SerializedObject.InputStreamFactory factory)java.lang.StringgetObjectToString()byte[]getSerializedData()voidreadExternal(java.io.ObjectInput in)voidwriteExternal(java.io.ObjectOutput out)java.lang.ObjectwriteReplace()
-
-
-
Constructor Detail
-
SerializedObject
public SerializedObject(java.lang.Object obj, boolean storeToString) throws java.io.NotSerializableException, java.io.IOExceptionThis is the public used constructor. It takes an object and attempts to serialize it.- Throws:
java.io.NotSerializableException- If obj is not Serializable.java.io.IOException- if an IO error occurs during Serialization, should not happen unless there is a bug.
-
SerializedObject
SerializedObject(byte[] data, java.lang.String objectToString)A private constructor used during the deserialization process of this object. Externalizable objects require a no-arg constructor so a replacement object is serialized in this object's place. On deserialization, this object is reconstructed using this constructor.- Parameters:
data- a byte[] containing the serialized data of the object that this object is holding.objectToString- The toString value of the stored object.
-
-
Method Detail
-
getSerializedData
public byte[] getSerializedData()
-
get
public java.lang.Object get() throws java.lang.ClassNotFoundException, java.io.IOException- Throws:
java.lang.ClassNotFoundExceptionjava.io.IOException
-
get
public java.lang.Object get(SerializedObject.InputStreamFactory factory) throws java.lang.ClassNotFoundException, java.io.IOException
- Throws:
java.lang.ClassNotFoundExceptionjava.io.IOException
-
getObjectToString
public java.lang.String getObjectToString()
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeReplace
public java.lang.Object writeReplace() throws java.io.ObjectStreamException- Throws:
java.io.ObjectStreamException
-
-