Simplified implementation.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2939 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2004-01-17 01:55:46 +00:00
parent afccde1dd2
commit 2552fd471b
@@ -1,10 +1,9 @@
// //
// $Id: StreamableArrayIntSet.java,v 1.1 2004/01/17 01:14:12 eric Exp $ // $Id: StreamableArrayIntSet.java,v 1.2 2004/01/17 01:55:46 ray Exp $
package com.threerings.util; package com.threerings.util;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator;
import com.samskivert.util.ArrayIntSet; import com.samskivert.util.ArrayIntSet;
@@ -18,7 +17,6 @@ import com.threerings.io.Streamable;
public class StreamableArrayIntSet extends ArrayIntSet public class StreamableArrayIntSet extends ArrayIntSet
implements Streamable implements Streamable
{ {
// documentation inherited // documentation inherited
public StreamableArrayIntSet (int[] values) public StreamableArrayIntSet (int[] values)
{ {
@@ -43,13 +41,8 @@ public class StreamableArrayIntSet extends ArrayIntSet
public void writeObject (ObjectOutputStream out) public void writeObject (ObjectOutputStream out)
throws IOException throws IOException
{ {
int size = size(); out.writeInt(_size);
out.writeInt(size); out.writeObject(_values);
Iterator itr = iterator();
while (itr.hasNext()) {
int value = ((Integer)itr.next()).intValue();
out.writeInt(value);
}
} }
/** /**
@@ -58,9 +51,7 @@ public class StreamableArrayIntSet extends ArrayIntSet
public void readObject (ObjectInputStream in) public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException throws IOException, ClassNotFoundException
{ {
int size = in.readInt(); _size = in.readInt();
for (int ii = 0; ii < size; ii++) { _values = (int[]) in.readObject();
add(in.readInt());
}
} }
} }