class SSU2Bitfield extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
SSU2Bitfield.Callback |
Constructor and Description |
---|
SSU2Bitfield(int size,
long offset)
Creates a new SSU2Bitfield that represents
size unset bits. |
Modifier and Type | Method and Description |
---|---|
void |
forEachAndNot(SSU2Bitfield bf2,
SSU2Bitfield.Callback cb)
Callback for all bits
set in this bitfield but not set in bf2.
|
static SSU2Bitfield |
fromACKBlock(long thru,
int acnt,
byte[] ranges,
int rangeCount) |
boolean |
get(long bit)
Return true if the bit is set or false if it is not.
|
long |
getHighestSet()
Return the highest set bit, or -1 if none.
|
long |
getOffset() |
boolean |
set(long bit)
Sets the given bit to true.
|
int |
size() |
SSU2Payload.AckBlock |
toAckBlock(int maxRanges) |
String |
toString() |
static String |
toString(long thru,
int acnt,
byte[] ranges,
int rangeCount)
Pretty print an ACK block
|
public SSU2Bitfield(int size, long offset)
size
unset bits.public int size()
public long getOffset()
public boolean set(long bit) throws IndexOutOfBoundsException
IndexOutOfBoundsException
- if bit is smaller then zero
OR if the shift is too bigpublic boolean get(long bit)
IndexOutOfBoundsException
- if bit is smaller then zeropublic long getHighestSet()
public SSU2Payload.AckBlock toAckBlock(int maxRanges)
maxRanges
- may be 0public static SSU2Bitfield fromACKBlock(long thru, int acnt, byte[] ranges, int rangeCount)
ranges
- may be nullpublic void forEachAndNot(SSU2Bitfield bf2, SSU2Bitfield.Callback cb)
public static String toString(long thru, int acnt, byte[] ranges, int rangeCount)
ranges
- may be null