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;
@@ -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 ()
@@ -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);
}
/**