|
XNIO API 3.1.0.Beta1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xnio.Bits
public final class Bits
General bit-affecting utility methods.
Method Summary | |
---|---|
static boolean |
allAreClear(int var,
int flags)
Determine if all of the flags in the given var are clear. |
static boolean |
allAreClear(long var,
long flags)
Determine if all of the flags in the given var are clear. |
static boolean |
allAreSet(int var,
int flags)
Determine if all of the flags in the given var are set. |
static boolean |
allAreSet(long var,
long flags)
Determine if all of the flags in the given var are set. |
static boolean |
anyAreClear(int var,
int flags)
Determine if any of the flags in the given var are clear. |
static boolean |
anyAreClear(long var,
long flags)
Determine if any of the flags in the given var are clear. |
static boolean |
anyAreSet(int var,
int flags)
Determine if any of the flags in the given var are set. |
static boolean |
anyAreSet(long var,
long flags)
Determine if any of the flags in the given var are set. |
static char |
charFromBytesBE(byte[] b,
int off)
Get a 16-bit signed big-endian char value from a byte array. |
static char |
charFromBytesLE(byte[] b,
int off)
Get a 16-bit signed little-endian char value from a byte array. |
static int |
intBitMask(int low,
int high)
Get an integer bit mask consisting of 1 bits in the given range. |
static int |
intFromBytesBE(byte[] b,
int off)
Get a 32-bit signed big-endian int value from a byte array. |
static int |
intFromBytesLE(byte[] b,
int off)
Get a 32-bit signed little-endian int value from a byte array. |
static long |
longBitMask(int low,
int high)
Get a long bit mask consisting of 1 bits in the given range. |
static long |
longFromBytesBE(byte[] b,
int off)
Get a 64-bit signed big-endian long value from a byte array. |
static long |
longFromBytesLE(byte[] b,
int off)
Get a 64-bit signed little-endian long value from a byte array. |
static int |
mediumFromBytesBE(byte[] b,
int off)
Get a 24-bit signed big-endian int value from a byte array. |
static int |
mediumFromBytesLE(byte[] b,
int off)
Get a 24-bit signed little-endian int value from a byte array. |
static short |
shortFromBytesBE(byte[] b,
int off)
Get a 16-bit signed big-endian short value from a byte array. |
static short |
shortFromBytesLE(byte[] b,
int off)
Get a 16-bit signed little-endian short value from a byte array. |
static int |
unsigned(byte v)
Convert a signed value to unsigned. |
static long |
unsigned(int v)
Convert a signed value to unsigned. |
static int |
unsigned(short v)
Convert a signed value to unsigned. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static int intBitMask(int low, int high)
int
will have bits low
through high
set, and all other bits clear.
low
- the low bit valuehigh
- the high bit value
public static long longBitMask(int low, int high)
long
will have bits low
through high
set, and all other bits clear.
low
- the low bit valuehigh
- the high bit value
public static boolean anyAreSet(int var, int flags)
flags
in the given var
are set.
var
- the value to testflags
- the flags to test for
true
if any of flags
are in var
, false
otherwisepublic static boolean allAreSet(int var, int flags)
flags
in the given var
are set.
var
- the value to testflags
- the flags to test for
true
if all of flags
are in var
, false
otherwisepublic static boolean anyAreClear(int var, int flags)
flags
in the given var
are clear.
var
- the value to testflags
- the flags to test for
true
if not all of flags
are in var
, false
otherwisepublic static boolean allAreClear(int var, int flags)
flags
in the given var
are clear.
var
- the value to testflags
- the flags to test for
true
if none of flags
are in var
, false
otherwisepublic static boolean anyAreSet(long var, long flags)
flags
in the given var
are set.
var
- the value to testflags
- the flags to test for
true
if any of flags
are in var
, false
otherwisepublic static boolean allAreSet(long var, long flags)
flags
in the given var
are set.
var
- the value to testflags
- the flags to test for
true
if all of flags
are in var
, false
otherwisepublic static boolean anyAreClear(long var, long flags)
flags
in the given var
are clear.
var
- the value to testflags
- the flags to test for
true
if not all of flags
are in var
, false
otherwisepublic static boolean allAreClear(long var, long flags)
flags
in the given var
are clear.
var
- the value to testflags
- the flags to test for
true
if none of flags
are in var
, false
otherwisepublic static int unsigned(byte v)
v
- the signed byte
public static int unsigned(short v)
v
- the signed short
public static long unsigned(int v)
v
- the signed int
public static short shortFromBytesLE(byte[] b, int off)
b
- the byte arrayoff
- the offset in the array
public static short shortFromBytesBE(byte[] b, int off)
b
- the byte arrayoff
- the offset in the array
public static char charFromBytesLE(byte[] b, int off)
b
- the byte arrayoff
- the offset in the array
public static char charFromBytesBE(byte[] b, int off)
b
- the byte arrayoff
- the offset in the array
public static int mediumFromBytesLE(byte[] b, int off)
b
- the byte arrayoff
- the offset in the array
public static int mediumFromBytesBE(byte[] b, int off)
b
- the byte arrayoff
- the offset in the array
public static int intFromBytesLE(byte[] b, int off)
b
- the byte arrayoff
- the offset in the array
public static int intFromBytesBE(byte[] b, int off)
b
- the byte arrayoff
- the offset in the array
public static long longFromBytesLE(byte[] b, int off)
b
- the byte arrayoff
- the offset in the array
public static long longFromBytesBE(byte[] b, int off)
b
- the byte arrayoff
- the offset in the array
|
XNIO API 3.1.0.Beta1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |