class SSU2Bitfield extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface | SSU2Bitfield.CallbackCallback interface for bitfield operations. |
| 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()size. |
SSU2Payload.AckBlock | toAckBlock(int maxRanges) |
String | toString()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 void forEachAndNot(SSU2Bitfield bf2, SSU2Bitfield.Callback cb)
public static SSU2Bitfield fromACKBlock(long thru, int acnt, byte[] ranges, int rangeCount)
ranges - may be nullpublic boolean get(long bit)
IndexOutOfBoundsException - if bit is smaller then zeropublic long getHighestSet()
public long getOffset()
public boolean set(long bit)
throws IndexOutOfBoundsExceptionIndexOutOfBoundsException - if bit is smaller then zero
OR if the shift is too bigpublic int size()
public SSU2Payload.AckBlock toAckBlock(int maxRanges)
maxRanges - may be 0public static String toString(long thru, int acnt, byte[] ranges, int rangeCount)
ranges - may be null