Clean up marshalling a bit.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@913 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-02-01 23:43:45 +00:00
parent b7913ceb0b
commit c1dcc614f7
2 changed files with 8 additions and 18 deletions
@@ -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; package com.threerings.micasa.lobby;
@@ -7,6 +7,7 @@ import java.io.IOException;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import com.threerings.presents.io.Marshaller;
import com.threerings.presents.io.Streamable; import com.threerings.presents.io.Streamable;
/** /**
@@ -47,18 +48,14 @@ public class Lobby implements Streamable
public void writeTo (DataOutputStream out) public void writeTo (DataOutputStream out)
throws IOException throws IOException
{ {
out.writeInt(placeOid); Marshaller.writeObject(out, this);
out.writeUTF(gameIdent);
out.writeUTF(name);
} }
// documentation inherited // documentation inherited
public void readFrom (DataInputStream in) public void readFrom (DataInputStream in)
throws IOException throws IOException
{ {
placeOid = in.readInt(); Marshaller.readObject(in, this);
gameIdent = in.readUTF();
name = in.readUTF();
} }
public String toString () public String toString ()
@@ -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; package com.threerings.whirled.data;
@@ -9,6 +9,7 @@ import java.io.DataOutputStream;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
import com.threerings.presents.io.Streamable; 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 * The scene model is the bare bones representation of the data for a
@@ -47,11 +48,7 @@ public class SceneModel
out.writeInt(sceneId); out.writeInt(sceneId);
out.writeUTF(sceneName); out.writeUTF(sceneName);
out.writeInt(version); out.writeInt(version);
int nlength = neighborIds.length; StreamableUtil.writeInts(out, neighborIds);
out.writeInt(nlength);
for (int i = 0; i < nlength; i++) {
out.writeInt(neighborIds[i]);
}
} }
// documentation inherited // documentation inherited
@@ -61,11 +58,7 @@ public class SceneModel
sceneId = in.readInt(); sceneId = in.readInt();
sceneName = in.readUTF(); sceneName = in.readUTF();
version = in.readInt(); version = in.readInt();
int nlength = in.readInt(); neighborIds = StreamableUtil.readInts(in);
neighborIds = new int[nlength];
for (int i = 0; i < nlength; i++) {
neighborIds[i] = in.readInt();
}
} }
/** /**