Bye bye to all the hand-serialization code. Yay!

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2077 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-12-20 23:28:24 +00:00
parent 00baff9000
commit 70a79f48e9
15 changed files with 26 additions and 290 deletions
@@ -1,5 +1,5 @@
//
// $Id: AuthRequest.java,v 1.9 2002/10/31 18:44:34 mdb Exp $
// $Id: AuthRequest.java,v 1.10 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -45,28 +45,6 @@ public class AuthRequest extends UpstreamMessage
return _version;
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeObject(_creds);
out.writeUTF(_version);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
_creds = (Credentials)in.readObject();
_version = in.readUTF();
}
/**
* Generates a string representation of this instance.
*/
@@ -1,5 +1,5 @@
//
// $Id: AuthResponse.java,v 1.12 2002/07/23 05:52:48 mdb Exp $
// $Id: AuthResponse.java,v 1.13 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -38,26 +38,6 @@ public class AuthResponse extends DownstreamMessage
return _data;
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeObject(_data);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
_data = (AuthResponseData)in.readObject();
}
public String toString ()
{
return "[type=ARSP, msgid=" + messageId + ", data=" + _data + "]";
@@ -1,5 +1,5 @@
//
// $Id: BootstrapNotification.java,v 1.4 2002/07/23 05:52:48 mdb Exp $
// $Id: BootstrapNotification.java,v 1.5 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -39,26 +39,6 @@ public class BootstrapNotification extends DownstreamMessage
return _data;
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeObject(_data);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
_data = (BootstrapData)in.readObject();
}
public String toString ()
{
return "[type=BOOT, msgid=" + messageId + ", data=" + _data + "]";
@@ -1,5 +1,5 @@
//
// $Id: Credentials.java,v 1.9 2002/09/18 21:58:30 mdb Exp $
// $Id: Credentials.java,v 1.10 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -46,26 +46,6 @@ public abstract class Credentials implements Streamable
return _username;
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.defaultWriteObject();
out.writeUTF(_username);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
_username = in.readUTF();
}
// documentation inherited
public int hashCode ()
{
@@ -1,5 +1,5 @@
//
// $Id: DownstreamMessage.java,v 1.9 2002/07/23 05:52:48 mdb Exp $
// $Id: DownstreamMessage.java,v 1.10 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -23,24 +23,6 @@ public abstract class DownstreamMessage extends SimpleStreamableObject
*/
public short messageId = -1;
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.defaultWriteObject();
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
}
/**
* Generates a string representation of this instance.
*/
@@ -1,5 +1,5 @@
//
// $Id: EventNotification.java,v 1.11 2002/07/23 05:52:48 mdb Exp $
// $Id: EventNotification.java,v 1.12 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -33,26 +33,6 @@ public class EventNotification extends DownstreamMessage
return _event;
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeObject(_event);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
_event = (DEvent)in.readObject();
}
public String toString ()
{
return "[type=EVT, evt=" + _event + "]";
@@ -1,5 +1,5 @@
//
// $Id: FailureResponse.java,v 1.8 2002/07/23 05:52:48 mdb Exp $
// $Id: FailureResponse.java,v 1.9 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -32,26 +32,6 @@ public class FailureResponse extends DownstreamMessage
return _oid;
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeInt(_oid);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
_oid = in.readInt();
}
public String toString ()
{
return "[type=FAIL, msgid=" + messageId + ", oid=" + _oid + "]";
@@ -1,5 +1,5 @@
//
// $Id: ForwardEventRequest.java,v 1.10 2002/07/23 05:52:48 mdb Exp $
// $Id: ForwardEventRequest.java,v 1.11 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -36,26 +36,6 @@ public class ForwardEventRequest extends UpstreamMessage
return _event;
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeObject(_event);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
_event = (DEvent)in.readObject();
}
public String toString ()
{
return "[type=FWD, evt=" + _event + "]";
@@ -1,5 +1,5 @@
//
// $Id: ObjectResponse.java,v 1.12 2002/07/23 05:52:48 mdb Exp $
// $Id: ObjectResponse.java,v 1.13 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -33,26 +33,6 @@ public class ObjectResponse extends DownstreamMessage
return _dobj;
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeObject(_dobj);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
_dobj = (DObject)in.readObject();
}
public String toString ()
{
return "[type=ORSP, msgid=" + messageId + ", obj=" + _dobj + "]";
@@ -1,5 +1,5 @@
//
// $Id: PingRequest.java,v 1.8 2002/10/29 23:51:26 mdb Exp $
// $Id: PingRequest.java,v 1.9 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -47,11 +47,11 @@ public class PingRequest extends UpstreamMessage
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
// grab a timestamp noting when we were encoded into a raw buffer
// for delivery over the network
_packStamp = System.currentTimeMillis();
out.defaultWriteObject();
}
/**
@@ -60,11 +60,11 @@ public class PingRequest extends UpstreamMessage
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
// grab a timestamp noting when we were decoded from a raw buffer
// after being received over the network
_unpackStamp = System.currentTimeMillis();
in.defaultReadObject();
}
public String toString ()
@@ -73,10 +73,10 @@ public class PingRequest extends UpstreamMessage
}
/** A time stamp obtained when we serialize this object. */
protected long _packStamp;
protected transient long _packStamp;
/** A time stamp obtained when we unserialize this object (the intent
* is to get a timestamp as close as possible to when the packet was
* received on the network). */
protected long _unpackStamp;
protected transient long _unpackStamp;
}
@@ -1,5 +1,5 @@
//
// $Id: PongResponse.java,v 1.8 2002/07/23 05:52:49 mdb Exp $
// $Id: PongResponse.java,v 1.9 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -65,11 +65,8 @@ public class PongResponse extends DownstreamMessage
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
// make a note of the time at which we were packed
_packStamp = System.currentTimeMillis();
out.writeLong(_packStamp);
// the time spent between unpacking the ping and packing the pong
// is the processing delay
@@ -80,7 +77,8 @@ public class PongResponse extends DownstreamMessage
} else {
_processDelay = (int)(_packStamp - _pingStamp);
}
out.writeInt(_processDelay);
out.defaultWriteObject();
}
/**
@@ -89,15 +87,11 @@ public class PongResponse extends DownstreamMessage
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
// grab a timestamp noting when we were decoded from a raw buffer
// after being received over the network
_unpackStamp = System.currentTimeMillis();
// read in our time stamps
_packStamp = in.readLong();
_processDelay = in.readInt();
in.defaultReadObject();
}
public String toString ()
@@ -108,7 +102,7 @@ public class PongResponse extends DownstreamMessage
/** The ping unpack stamp provided at construct time to this pong
* response; only valid on the sending process, not the receiving
* process. */
protected long _pingStamp;
protected transient long _pingStamp;
/** The timestamp obtained immediately before this packet was sent out
* over the network. */
@@ -122,5 +116,5 @@ public class PongResponse extends DownstreamMessage
/** A time stamp obtained when we unserialize this object (the intent
* is to get a timestamp as close as possible to when the packet was
* received on the network). */
protected long _unpackStamp;
protected transient long _unpackStamp;
}
@@ -1,5 +1,5 @@
//
// $Id: SubscribeRequest.java,v 1.6 2002/07/23 05:52:49 mdb Exp $
// $Id: SubscribeRequest.java,v 1.7 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -35,26 +35,6 @@ public class SubscribeRequest extends UpstreamMessage
return _oid;
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeInt(_oid);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
_oid = in.readInt();
}
public String toString ()
{
return "[type=SUB, msgid=" + messageId + ", oid=" + _oid + "]";
@@ -1,5 +1,5 @@
//
// $Id: UnsubscribeRequest.java,v 1.7 2002/07/23 05:52:49 mdb Exp $
// $Id: UnsubscribeRequest.java,v 1.8 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -35,26 +35,6 @@ public class UnsubscribeRequest extends UpstreamMessage
return _oid;
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeInt(_oid);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
_oid = in.readInt();
}
public String toString ()
{
return "[type=UNSUB, msgid=" + messageId + ", oid=" + _oid + "]";
@@ -1,5 +1,5 @@
//
// $Id: UpstreamMessage.java,v 1.9 2002/07/23 05:52:49 mdb Exp $
// $Id: UpstreamMessage.java,v 1.10 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -37,24 +37,6 @@ public abstract class UpstreamMessage extends SimpleStreamableObject
this.messageId = nextMessageId();
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.defaultWriteObject();
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
}
public String toString ()
{
return "[msgid=" + messageId + "]";
@@ -1,5 +1,5 @@
//
// $Id: UsernamePasswordCreds.java,v 1.9 2002/09/18 22:06:54 mdb Exp $
// $Id: UsernamePasswordCreds.java,v 1.10 2002/12/20 23:28:24 mdb Exp $
package com.threerings.presents.net;
@@ -32,26 +32,6 @@ public class UsernamePasswordCreds extends Credentials
return _password;
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeUTF(_password);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
super.readObject(in);
_password = in.readUTF();
}
// documentation inherited
public int hashCode ()
{