org.codehaus.activemq.util
Class BitArray
java.lang.Object
org.codehaus.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.3 $
Method Summary |
boolean |
get(int index)
|
long |
getBits()
|
int |
length()
|
void |
readFromStream(java.io.DataInput dataIn)
read the bits from an input stream |
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 |
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
BitArray
public BitArray()
length
public int length()
- Returns:
- the length of bits set
getBits
public long getBits()
- Returns:
- the long containing the bits
set
public boolean set(int index,
boolean flag)
- set the boolean value at the index
- Parameters:
index
- flag
-
- Returns:
- the old value held at this index
get
public boolean get(int index)
- Parameters:
index
-
- Returns:
- the boolean value at this index
writeToStream
public void writeToStream(java.io.DataOutput dataOut)
throws java.io.IOException
- write the bits to an output stream
- Parameters:
dataOut
-
- Throws:
java.io.IOException
readFromStream
public void readFromStream(java.io.DataInput dataIn)
throws java.io.IOException
- read the bits from an input stream
- Parameters:
dataIn
-
- Throws:
java.io.IOException
Copyright © 2004 Protique, Ltd.. All Rights Reserved.