|
RADIUS Client API (V3) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectBitArray
Class to handle bit operations.
| Field Summary | |
static int |
BYTE_SIZE
Bit size of a byte 8. |
static int |
INT_SIZE
Bit size of an integer 32. |
| Constructor Summary | |
BitArray(byte[] b)
Constructor initialized by byte array, |
|
BitArray(byte[] b,
int maxBytes)
Constructor initialized by byte array, |
|
BitArray(int length)
Constructor with maximum length in bytes for bit array. |
|
| Method Summary | |
int |
cardinality()
Count bits (for parity). |
void |
clear()
Clear all bits. |
void |
clear(int n)
Clear a bit. |
void |
clear(int fromIndex,
int toIndex)
Sets the bits from the specified fromIndex(inclusive) to the specified toIndex(exclusive) to false. |
static int |
concoctInt(byte[] b,
int start)
Converts 4 bytes of a byte array into an int from the starting position. |
byte[] |
extractBytes(int start,
int length)
Extract some bits at a particular position. |
int |
extractInt(int start,
int length)
Extract some bits at a particular position. |
long |
extractLong(int start,
int length)
Extract some bits at a particular position. |
boolean |
get(int n)
Get a bit value. |
int |
getMaximumBits()
Get the number of bits in the array. |
boolean |
isEmpty()
Returns true if this BitArray contains no bits that are set to true. |
int |
length()
Get the length of the BitArray. |
static void |
main(String[] a)
Test of BitArray. |
int |
nextClearBit(int posn)
Find the position of the next clear bit. |
int |
nextSetBit(int posn)
Find the position of the next set bit. |
void |
reset()
Clear all bits. |
void |
set(int n)
Set a bit at a position. |
void |
set(int n,
boolean v)
Set a bit at a position depending on the boolean value.. |
byte[] |
toByteArray()
Return the bit array as a byte array. |
String |
toHexString()
Convert to hex string |
String |
toString()
Display as binary string. |
boolean |
xor()
Xor all bits (parity). |
| Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int INT_SIZE
public static final int BYTE_SIZE
| Constructor Detail |
public BitArray(int length)
length - Number of bits in array.public BitArray(byte[] b)
b - Byte array.
public BitArray(byte[] b,
int maxBytes)
b - Byte array.maxBytes - maximum number of bytes.| Method Detail |
public void set(int n)
n - bit position.
public void set(int n,
boolean v)
n - bit position.v - boolean value to set.public boolean get(int n)
n - bit position.
public int cardinality()
public boolean xor()
public int extractInt(int start,
int length)
start - Start position.length - Number of bits to extract
(limited to 32 bits for an int value).
public long extractLong(int start,
int length)
start - Start position.length - Number of bits to extract
(limited to 64 bits for a long value).
public byte[] extractBytes(int start,
int length)
start - Start position.length - Number of bits to extract
(limited to 64 bits for a long value).public void clear(int n)
n - bit position.
public void clear(int fromIndex,
int toIndex)
fromIndex - Starting index.toIndex - Ending index.public boolean isEmpty()
public void clear()
public void reset()
public byte[] toByteArray()
public String toHexString()
public String toString()
public int getMaximumBits()
public static void main(String[] a)
public static int concoctInt(byte[] b,
int start)
int from the starting position.
b - buffer.start - postion to extract data
public int nextClearBit(int posn)
posn - Position to start searching for the next clear bit.
public int nextSetBit(int posn)
posn - Position to start searching for the next set bit.
public int length()
|
RADIUS Client API (V3) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||