Package gnu.cajo.utils.extra
Class Zedmobject
- java.lang.Object
-
- gnu.cajo.utils.extra.Zedmobject
-
- All Implemented Interfaces:
Invoke
,java.io.Serializable
,java.rmi.Remote
public final class Zedmobject extends java.lang.Object implements Invoke
This class is used to transfer an object between Virtual Machines as a zipped marshalled object (zedmob). It will compress the object automatically on serialisation, and decompress it automatically upon deserialisation. This will incur a small runtime penalty, however, if the object is large and highly compressable, or the data link is slow, or the cost per byte to transmit data is high, this can become highly advantageous.- Version:
- 1.0, 16-Mar-05 Initial release
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.Object
object
The wrapped object.private byte[]
payload
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description Zedmobject(java.lang.Object object)
The constructor simply assigns the reference to the member object referece.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
invoke(java.lang.String method, java.lang.Object args)
The invocation interface to the internal object.private void
readObject(java.io.ObjectInputStream in)
private void
writeObject(java.io.ObjectOutputStream out)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
payload
private byte[] payload
-
object
public transient java.lang.Object object
The wrapped object. Normally it would be accessed through the wrapper's Invoke interface. However, direct access is provided for cases where the wrapped object is purely data, for example a byte[]. It is declared transient since it never travels over the network in its uncompressed form.
-
-
Constructor Detail
-
Zedmobject
public Zedmobject(java.lang.Object object)
The constructor simply assigns the reference to the member object referece. The only restriction, quite naturally, is that the object argument must be serialisable.- Parameters:
object
- The object to be de/compressed receipt/transmission.
-
-
Method Detail
-
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
invoke
public java.lang.Object invoke(java.lang.String method, java.lang.Object args) throws java.lang.Exception
The invocation interface to the internal object. It is used to invoke any of the object's public methods. It uses the Remote.invoke paradigm internally, to make the presence of the zedmobject transparent.- Specified by:
invoke
in interfaceInvoke
- Parameters:
method
- The name of the public method to invoke.args
- The data, to be provided to the method as arguments, if any.- Returns:
- Any synchronous data defined by a subclass' implementation, it can be an array of of objects, or possibly null
- Throws:
java.lang.Exception
- For any method-specific reasons.
-
-