Package org.jcsp.net
Class SerializedObject
java.lang.Object
org.jcsp.net.SerializedObject
- All Implemented Interfaces:
Externalizable
,Serializable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
This class exists purely for performance reasons.private class
private static class
This class exists because the main class cannot have a no-arg constructor as required by externalizable.static interface
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSerializedObject
(byte[] data, String objectToString) A private constructor used during the deserialization process of this object.SerializedObject
(Object obj, boolean storeToString) This is the public used constructor. -
Method Summary
Modifier and TypeMethodDescriptionget()
get
(SerializedObject.InputStreamFactory factory) byte[]
void
void
-
Field Details
-
serializedData
private byte[] serializedData -
objectToString
-
-
Constructor Details
-
SerializedObject
public SerializedObject(Object obj, boolean storeToString) throws NotSerializableException, IOException This is the public used constructor. It takes an object and attempts to serialize it.- Throws:
NotSerializableException
- If obj is not Serializable.IOException
- if an IO error occurs during Serialization, should not happen unless there is a bug.
-
SerializedObject
SerializedObject(byte[] data, 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 Details
-
getSerializedData
public byte[] getSerializedData() -
get
- Throws:
ClassNotFoundException
IOException
-
get
public Object get(SerializedObject.InputStreamFactory factory) throws ClassNotFoundException, IOException - Throws:
ClassNotFoundException
IOException
-
getObjectToString
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
writeReplace
- Throws:
ObjectStreamException
-