class SerializedData
extends java.lang.Object
implements java.io.Externalizable
DynamicClassLoaderMessage
. The object is
serialized to a byte array for transfer to another node. This will allow the message to be
deserialized to obtain the JFTP reference even if the class held here is not available. When the
relevant class has been loaded the data from the byte array can be deserialized.Modifier and Type | Class and Description |
---|---|
private static class |
SerializedData.AccesibleByteArrayOutputStream
This class exists purely for performance reasons.
|
private class |
SerializedData.BasicInputStreamFactory
Implementation of the
InputStreamFactory to create a ObjectInputStream . |
private static class |
SerializedData.ExtClass
This class exists because the main class cannot have a no-arg
constructor as required by externalizable.
|
static interface |
SerializedData.InputStreamFactory
Factory for creating object input streams.
|
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
objectToString
The string representation of the object.
|
private byte[] |
serializedData
The binary form of the object in this message.
|
Constructor and Description |
---|
SerializedData(byte[] data,
java.lang.String objectToString)
A private constructor used during the deserialization process of this
object.
|
SerializedData(java.lang.Object obj,
boolean storeToString)
This is the public used constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
get()
Deserializes the object from the byte[] array and returns it.
|
java.lang.Object |
get(SerializedData.InputStreamFactory factory)
Deserializes the object from the byte[] array and returns it.
|
java.lang.String |
getObjectToString()
Returns the string form of an object.
|
byte[] |
getSerializedData()
Returns the binary serialized object.
|
void |
readExternal(java.io.ObjectInput in) |
void |
writeExternal(java.io.ObjectOutput out) |
java.lang.Object |
writeReplace()
Replaces this object with another during serialization.
|
private byte[] serializedData
private java.lang.String objectToString
public SerializedData(java.lang.Object obj, boolean storeToString) throws java.io.NotSerializableException, java.io.IOException
obj
- the Object to Serialize.storeToString
- if true
will create a string representation of the serialized object.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.SerializedData(byte[] data, java.lang.String objectToString)
data
- a byte[] containing the serialized data of the object
that this object is holding.objectToString
- The toString value of the stored object.public byte[] getSerializedData()
public java.lang.Object get() throws java.lang.ClassNotFoundException, java.io.IOException
java.lang.ClassNotFoundException
- if the class is not available locally and should be requested.java.io.IOException
- if there is a problem with the stream.public java.lang.Object get(SerializedData.InputStreamFactory factory) throws java.lang.ClassNotFoundException, java.io.IOException
factory
- the factory for creating the input stream.java.lang.ClassNotFoundException
- if the class is not available locally and should be requested.java.io.IOException
- if there is a problem with the stream.public java.lang.String getObjectToString()
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public java.lang.Object writeReplace() throws java.io.ObjectStreamException
java.io.ObjectStreamException