//
// $Id: ObjectResponse.java,v 1.2 2001/05/23 04:03:40 mdb Exp $

package com.samskivert.cocktail.cher.net;

import java.io.IOException;
import java.io.DataInputStream;
import java.io.DataOutputStream;

import com.samskivert.cocktail.cher.dobj.DObject;
import com.samskivert.cocktail.cher.io.TypedObjectFactory;

public class ObjectResponse extends DownstreamMessage
{
    /** The code for an event notification. */
    public static final short TYPE = TYPE_BASE + 2;

    /**
     * Zero argument constructor used when unserializing an instance.
     */
    public ObjectResponse ()
    {
        super();
    }

    /**
     * Constructs an object response with supplied distributed object that
     * is associated with the specified upstream message id.
     */
    public ObjectResponse (short messageId, DObject dobj)
    {
        this.messageId = messageId;
        _dobj = dobj;
    }

    public short getType ()
    {
        return TYPE;
    }

    public void writeTo (DataOutputStream out)
        throws IOException
    {
        super.writeTo(out);
        out.writeShort(messageId);
        TypedObjectFactory.writeTo(out, _dobj);
    }

    public void readFrom (DataInputStream in)
        throws IOException
    {
        super.readFrom(in);
        messageId = in.readShort();
        _dobj = (DObject)TypedObjectFactory.readFrom(in);
    }

    /** The object which is associated with this response. */
    protected DObject _dobj;
}

@@ -28,17 +28,17 @@
 ava,v 1.
-2
+3
  2001/05
@@ -43,17 +43,17 @@
 05/2
-3 04:03:4
+9 03:28:5
 0 md
@@ -288,16 +288,14 @@
 her.
-io.Typed
+dobj.D
 Obje
@@ -1101,21 +1101,17 @@
         
-Typed
+D
 ObjectFa
@@ -1316,13 +1316,9 @@
 ect)
-Typed
+D
 Obje

Use the DObjectFactory to move DObjects over the wire.