Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.util
Class BitArray  view BitArray download BitArray.java

java.lang.Object
  extended byorg.activemq.util.BitArray

public class BitArray
extends java.lang.Object

Simple BitArray to enable setting multiple boolean values efficently Used instead of BitSet because BitSet does not allow for efficent serialization. Will store up to 64 boolean values

Version:
$Revision: 1.1.1.1 $

Field Summary
private static long[] BIT_VALUES
           
private  long bits
           
(package private) static int BYTE_SIZE
           
(package private) static int INT_SIZE
           
private  int length
           
(package private) static int LONG_SIZE
           
(package private) static int SHORT_SIZE
           
 
Constructor Summary
BitArray()
           
 
Method Summary
 boolean get(int index)
           
 long getBits()
           
 int length()
           
 void readFromStream(java.io.DataInput dataIn)
          read the bits from an input stream
 void reset()
          reset all the bit values to false
 void reset(long bits)
          reset all the bits to the value supplied
 boolean set(int index, boolean flag)
          set the boolean value at the index
 void writeToStream(java.io.DataOutput dataOut)
          write the bits to an output stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LONG_SIZE

static final int LONG_SIZE
See Also:
Constant Field Values

INT_SIZE

static final int INT_SIZE
See Also:
Constant Field Values

SHORT_SIZE

static final int SHORT_SIZE
See Also:
Constant Field Values

BYTE_SIZE

static final int BYTE_SIZE
See Also:
Constant Field Values

BIT_VALUES

private static final long[] BIT_VALUES

bits

private long bits

length

private int length
Constructor Detail

BitArray

public BitArray()
Method Detail

length

public int length()

getBits

public long getBits()

set

public boolean set(int index,
                   boolean flag)
set the boolean value at the index


get

public boolean get(int index)

reset

public void reset()
reset all the bit values to false


reset

public void reset(long bits)
reset all the bits to the value supplied


writeToStream

public void writeToStream(java.io.DataOutput dataOut)
                   throws java.io.IOException
write the bits to an output stream


readFromStream

public void readFromStream(java.io.DataInput dataIn)
                    throws java.io.IOException
read the bits from an input stream