More revamped serialization cleanup.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2079 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-12-20 23:41:27 +00:00
parent ee9049fe3e
commit 48823b10f9
22 changed files with 23 additions and 291 deletions
@@ -1,13 +1,11 @@
//
// $Id: CompoundEvent.java,v 1.7 2002/12/20 23:29:04 mdb Exp $
// $Id: CompoundEvent.java,v 1.8 2002/12/20 23:41:26 mdb Exp $
package com.threerings.presents.dobj;
import java.util.ArrayList;
import java.util.List;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.util.StreamableArrayList;
/**
@@ -1,12 +1,8 @@
//
// $Id: DEvent.java,v 1.11 2002/07/23 05:52:48 mdb Exp $
// $Id: DEvent.java,v 1.12 2002/12/20 23:41:26 mdb Exp $
package com.threerings.presents.dobj;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
/**
@@ -91,26 +87,6 @@ public abstract class DEvent implements Streamable
// the default is to do nothing
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.defaultWriteObject();
out.writeInt(_toid);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
_toid = in.readInt();
}
/**
* Constructs and returns a string representation of this event.
*/
@@ -1,17 +1,14 @@
//
// $Id: DObject.java,v 1.55 2002/12/12 00:30:47 mdb Exp $
// $Id: DObject.java,v 1.56 2002/12/20 23:41:26 mdb Exp $
package com.threerings.presents.dobj;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import com.samskivert.util.ListUtil;
import com.samskivert.util.StringUtil;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
import com.threerings.presents.Log;
@@ -696,26 +693,6 @@ public class DObject implements Streamable
}
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.defaultWriteObject();
out.writeInt(_oid);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
_oid = in.readInt();
}
/**
* Removes this object from participation in any transaction in which
* it might be taking part.
@@ -1,17 +1,14 @@
//
// $Id: DSet.java,v 1.24 2002/12/20 23:29:04 mdb Exp $
// $Id: DSet.java,v 1.25 2002/12/20 23:41:26 mdb Exp $
package com.threerings.presents.dobj;
import java.io.IOException;
import java.util.Comparator;
import java.util.Iterator;
import com.samskivert.util.ArrayUtil;
import com.samskivert.util.StringUtil;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
import com.threerings.presents.Log;
@@ -297,36 +294,6 @@ public class DSet
}
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.defaultWriteObject();
int ecount = _entries.length;
for (int ii = 0; ii < ecount; ii++) {
if (_entries[ii] != null) {
out.writeObject(_entries[ii]);
}
}
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
_entries = new Entry[Math.max(_size, INITIAL_CAPACITY)];
for (int ii = 0; ii < _size; ii++) {
_entries[ii] = (Entry)in.readObject();
}
}
/**
* Generates a string representation of this set instance.
*/
@@ -347,7 +314,7 @@ public class DSet
}
/** The entries of the set (in a sparse array). */
protected transient Entry[] _entries = new Entry[INITIAL_CAPACITY];
protected Entry[] _entries = new Entry[INITIAL_CAPACITY];
/** The number of entries in this set. */
protected int _size;
@@ -1,12 +1,8 @@
//
// $Id: OidList.java,v 1.5 2002/07/23 05:52:48 mdb Exp $
// $Id: OidList.java,v 1.6 2002/12/20 23:41:26 mdb Exp $
package com.threerings.presents.dobj;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
/**
@@ -113,28 +109,6 @@ public class OidList implements Streamable
return _oids[index];
}
/**
* Writes our custom streamable fields.
*/
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.defaultWriteObject();
out.writeInt(_size);
out.writeObject(_oids);
}
/**
* Reads our custom streamable fields.
*/
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
_size = in.readInt();
_oids = (int[])in.readObject();
}
public String toString ()
{
StringBuffer buf = new StringBuffer();