|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.amx.duet.tools.lang.Bits
Utility methods for packing/unpacking primitive values in/out of byte arrays using big-endian byte ordering.
Constructor Summary | |
Bits()
|
Method Summary | |
static byte[] |
flipBytes(byte[] b)
Changes the order of a byte array for endianness. |
static boolean |
getBoolean(byte[] b,
int off)
Method for unpacking boolean values from byte arrays starting at given offsets. |
static char |
getChar(byte[] b,
int off)
Method for unpacking character values from byte arrays starting at given offsets. |
static double |
getDouble(byte[] b,
int off)
Method for unpacking double values from byte arrays starting at given offsets. |
static float |
getFloat(byte[] b,
int off)
Method for unpacking float values from byte arrays starting at given offsets. |
static int |
getInt(byte[] b,
int off)
Method for unpacking integer values from byte arrays starting at given offsets. |
static long |
getLong(byte[] b,
int off)
Method for unpacking long values from byte arrays starting at given offsets. |
static short |
getShort(byte[] b,
int off)
Method for unpacking short values from byte arrays starting at given offsets. |
static boolean |
isBitSet(int value,
int pos)
Checks to see if the bit position in an 8 bit value is set. |
static void |
putBoolean(byte[] b,
int off,
boolean val)
Method for packing boolean values into byte arrays starting at given offsets. |
static void |
putChar(byte[] b,
int off,
char val)
Method for packing character values into byte arrays starting at given offsets. |
static void |
putDouble(byte[] b,
int off,
double val)
Method for packing double values into byte arrays starting at given offsets. |
static void |
putFloat(byte[] b,
int off,
float val)
Method for packing float values into byte arrays starting at given offsets. |
static void |
putInt(byte[] b,
int off,
int val)
Method for packing integer values into byte arrays starting at given offsets. |
static void |
putLong(byte[] b,
int off,
long val)
Method for packing long values into byte arrays starting at given offsets. |
static void |
putShort(byte[] b,
int off,
short val)
Method for packing short values into byte arrays starting at given offsets. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Bits()
Method Detail |
public static final boolean getBoolean(byte[] b, int off)
b
- off
-
public static final char getChar(byte[] b, int off)
b
- off
-
public static final short getShort(byte[] b, int off)
b
- off
-
public static final int getInt(byte[] b, int off)
b
- off
-
public static final float getFloat(byte[] b, int off)
b
- off
-
public static final long getLong(byte[] b, int off)
b
- off
-
public static final double getDouble(byte[] b, int off)
b
- off
-
public static final void putBoolean(byte[] b, int off, boolean val)
b
- off
- val
- public static final void putChar(byte[] b, int off, char val)
b
- off
- val
- public static final void putShort(byte[] b, int off, short val)
b
- off
- val
- public static final void putInt(byte[] b, int off, int val)
b
- off
- val
- public static final void putFloat(byte[] b, int off, float val)
b
- off
- val
- public static final void putLong(byte[] b, int off, long val)
b
- off
- val
- public static final void putDouble(byte[] b, int off, double val)
b
- off
- val
- public static final boolean isBitSet(int value, int pos)
value
- 8 bit valuepos
- 0-7 (bytes 1-8 respectively)
public static final byte[] flipBytes(byte[] b)
b
- byte array to flip.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |