//
// $Id: DObjectFactory.java,v 1.11 2002/02/01 23:32:37 mdb Exp $

package com.threerings.presents.dobj.io;

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

import com.threerings.presents.Log;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.io.Marshaller;
import com.threerings.presents.io.ObjectStreamException;

/**
 * The distributed object factory is responsible for marshalling and
 * unmarshalling distributed objects to and from streams so that they can
 * be communicated between the client and server.
 */
public class DObjectFactory
{
    /**
     * Writes the supplied distributed object out to the specified data
     * output stream.
     */
    public static void writeTo (DataOutputStream out, DObject dobj)
        throws IOException
    {
        // Log.info("Marshalling object: " + dobj);

        // write the class of the object to the stream
        out.writeUTF(dobj.getClass().getName());
        // write out the oid
        out.writeInt(dobj.getOid());
        // then use the marshaller to write the object itself
        Marshaller.writeObject(out, dobj);
    }

    /**
     * Reads a distributed object from the specified input stream.
     */
    public static DObject readFrom (DataInputStream in)
        throws IOException
    {
        try {
            // read in the class name and create an instance of that class
            Class clazz = Class.forName(in.readUTF());
            DObject dobj = (DObject)clazz.newInstance();
            dobj.setOid(in.readInt()); // read and set the oid

            // Log.info("Unmarshalling object: " + dobj);

            // use a marshaller to reconstitute the object from the stream
            Marshaller.readObject(in, dobj);

            return dobj;

        } catch (Exception e) {
            String errmsg = "Failure unserializing dobj";
            throw new ObjectStreamException(errmsg, e);
        }
    }
}

@@ -33,29 +33,29 @@
  1.1
-1
+2
  2002/0
-2/01 23:32:37
+7/18 00:42:30
  mdb
@@ -825,24 +825,26 @@
 n%0A    %7B%0A
+//
         
 // Log.i
@@ -827,34 +827,32 @@
     %7B%0A//        
-//
  Log.info(%22Marsh
@@ -1597,16 +1597,18 @@
 he oid%0A%0A
+//
         
@@ -1611,18 +1611,16 @@
         
-//
  Log.inf
@@ -1638,34 +1638,142 @@
 lling object
-: %22 + dobj
+ %22 +%0A//                      %22%5Bclass=%22 + dobj.getClass().getName() +%0A//                      %22, object=%22 + dobj + %22%5D.%22
 );%0A%0A        

Debug logging changes.