//
// $Id: StreamableArrayIntSet.java,v 1.1 2004/01/17 01:14:12 eric Exp $

package com.threerings.util;

import java.io.IOException;
import java.util.Iterator;

import com.samskivert.util.ArrayIntSet;

import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;

/**
 * A {@link ArrayIntSet} extension that can be streamed.
 */
public class StreamableArrayIntSet extends ArrayIntSet
    implements Streamable
{

    // documentation inherited
    public StreamableArrayIntSet (int[] values)
    {
        super(values);
    }

    // documentation inherited
    public StreamableArrayIntSet (int initialCapacity)
    {
        super(initialCapacity);
    }

    // documentation inherited
    public StreamableArrayIntSet ()
    {
        super();
    }

    /**
     * Writes our custom streamable fields.
     */
    public void writeObject (ObjectOutputStream out)
        throws IOException
    {
        int size = size();
        out.writeInt(size);
        Iterator itr = iterator();
        while (itr.hasNext()) {
            int value = ((Integer)itr.next()).intValue();
            out.writeInt(value);
        }
    }

    /**
     * Reads our custom streamable fields.
     */
    public void readObject (ObjectInputStream in)
        throws IOException, ClassNotFoundException
    {
        int size = in.readInt();
        for (int ii = 0; ii < size; ii++) {
            add(in.readInt());
        }
    }
}

@@ -35,17 +35,17 @@
 ava,v 1.
-1
+2
  2004/01
@@ -55,18 +55,17 @@
  01:
-14:12 eric
+55:46 ray
  Exp
@@ -129,35 +129,8 @@
 ion;
-%0Aimport java.util.Iterator;
 %0A%0Aim
@@ -443,17 +443,16 @@
 mable%0A%7B%0A
-%0A
     // d
@@ -936,35 +936,8 @@
   %7B%0A
-        int size = size();%0A
     
@@ -957,144 +957,16 @@
 Int(
+_
 size);%0A
-        Iterator itr = iterator();%0A        while (itr.hasNext()) %7B%0A            int value = ((Integer)itr.next()).intValue();%0A    
     
@@ -982,30 +982,25 @@
 rite
-In
+Objec
 t(
+_
 value
+s
 );%0A
-        %7D%0A
     
@@ -1176,20 +1176,17 @@
         
-int 
+_
 size = i
@@ -1210,84 +1210,42 @@
     
-for (int ii = 0; ii %3C size; ii++) %7B%0A            add(in.readInt());%0A        %7D
+_values = (int%5B%5D) in.readObject();
 %0A   

Simplified implementation.