From c1dcc614f7384e3158c6d74881889149ceb636f0 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 1 Feb 2002 23:43:45 +0000 Subject: [PATCH] Clean up marshalling a bit. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@913 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/micasa/lobby/Lobby.java | 11 ++++------- .../com/threerings/whirled/data/SceneModel.java | 15 ++++----------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/java/com/threerings/micasa/lobby/Lobby.java b/src/java/com/threerings/micasa/lobby/Lobby.java index ed6528ebb..21377da92 100644 --- a/src/java/com/threerings/micasa/lobby/Lobby.java +++ b/src/java/com/threerings/micasa/lobby/Lobby.java @@ -1,5 +1,5 @@ // -// $Id: Lobby.java,v 1.2 2001/10/11 04:13:33 mdb Exp $ +// $Id: Lobby.java,v 1.3 2002/02/01 23:43:45 mdb Exp $ package com.threerings.micasa.lobby; @@ -7,6 +7,7 @@ import java.io.IOException; import java.io.DataInputStream; import java.io.DataOutputStream; +import com.threerings.presents.io.Marshaller; import com.threerings.presents.io.Streamable; /** @@ -47,18 +48,14 @@ public class Lobby implements Streamable public void writeTo (DataOutputStream out) throws IOException { - out.writeInt(placeOid); - out.writeUTF(gameIdent); - out.writeUTF(name); + Marshaller.writeObject(out, this); } // documentation inherited public void readFrom (DataInputStream in) throws IOException { - placeOid = in.readInt(); - gameIdent = in.readUTF(); - name = in.readUTF(); + Marshaller.readObject(in, this); } public String toString () diff --git a/src/java/com/threerings/whirled/data/SceneModel.java b/src/java/com/threerings/whirled/data/SceneModel.java index d481fbfbf..6c01ef04d 100644 --- a/src/java/com/threerings/whirled/data/SceneModel.java +++ b/src/java/com/threerings/whirled/data/SceneModel.java @@ -1,5 +1,5 @@ // -// $Id: SceneModel.java,v 1.6 2001/12/12 19:06:15 mdb Exp $ +// $Id: SceneModel.java,v 1.7 2002/02/01 23:43:45 mdb Exp $ package com.threerings.whirled.data; @@ -9,6 +9,7 @@ import java.io.DataOutputStream; import com.samskivert.util.StringUtil; import com.threerings.presents.io.Streamable; +import com.threerings.presents.io.StreamableUtil; /** * The scene model is the bare bones representation of the data for a @@ -47,11 +48,7 @@ public class SceneModel out.writeInt(sceneId); out.writeUTF(sceneName); out.writeInt(version); - int nlength = neighborIds.length; - out.writeInt(nlength); - for (int i = 0; i < nlength; i++) { - out.writeInt(neighborIds[i]); - } + StreamableUtil.writeInts(out, neighborIds); } // documentation inherited @@ -61,11 +58,7 @@ public class SceneModel sceneId = in.readInt(); sceneName = in.readUTF(); version = in.readInt(); - int nlength = in.readInt(); - neighborIds = new int[nlength]; - for (int i = 0; i < nlength; i++) { - neighborIds[i] = in.readInt(); - } + neighborIds = StreamableUtil.readInts(in); } /**