com.threerings.io
Class ArrayMask

java.lang.Object
  extended by com.threerings.io.ArrayMask

public class ArrayMask
extends Object

Used to keep track of which entries in an array are null and which are not. Note: only arrays up to 262,144 elements in length can be handled by this class.


Field Summary
protected  byte[] _mask
          A byte array with bits for every entry in the source array.
 
Constructor Summary
ArrayMask()
          Creates an array mask suitable for unserializing.
ArrayMask(int length)
          Creates an array mask for an array of the specified length.
 
Method Summary
 boolean isSet(int index)
          Returns true if the specified array index should be non-null.
 void readFrom(ObjectInputStream in)
          Reads this mask from the specified input stream.
 void set(int index)
          Sets the bit indicating that the specified array index is non-null.
 void writeTo(ObjectOutputStream out)
          Writes this mask to the specified output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_mask

protected byte[] _mask
A byte array with bits for every entry in the source array.

Constructor Detail

ArrayMask

public ArrayMask()
Creates an array mask suitable for unserializing.


ArrayMask

public ArrayMask(int length)
Creates an array mask for an array of the specified length.

Method Detail

set

public void set(int index)
Sets the bit indicating that the specified array index is non-null.


isSet

public boolean isSet(int index)
Returns true if the specified array index should be non-null.


writeTo

public void writeTo(ObjectOutputStream out)
             throws IOException
Writes this mask to the specified output stream.

Throws:
IOException

readFrom

public void readFrom(ObjectInputStream in)
              throws IOException
Reads this mask from the specified input stream.

Throws:
IOException