Class Zedmobject

java.lang.Object
gnu.cajo.utils.extra.Zedmobject
All Implemented Interfaces:
Invoke, Serializable, Remote

public final class Zedmobject extends 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:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • payload

      private byte[] payload
    • object

      public transient 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 Details

    • Zedmobject

      public Zedmobject(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 Details

    • writeObject

      private void writeObject(ObjectOutputStream out) throws IOException
      Throws:
      IOException
    • readObject

      private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
      Throws:
      IOException
      ClassNotFoundException
    • invoke

      public Object invoke(String method, Object args) throws 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 interface Invoke
      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:
      Exception - For any method-specific reasons.