|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.org.retep.util.io.BitUtils
public final class BitUtils
A set of methods to convert between byte[] and primitive types.
| Method Summary | |
|---|---|
static boolean |
getBoolean(byte[] b,
int off)
Return a boolean value |
static char |
getChar(byte[] b,
int off)
Return a char value, encoded with 2 bytes |
static double |
getDouble(byte[] b,
int off)
Return a double value |
static float |
getFloat(byte[] b,
int off)
Return a float value |
static int |
getInt(byte[] b,
int off)
Return a integer value |
static int |
getInt3(byte[] b,
int off)
Return a integer value encoded with just 3 bytes instead of 4. |
static long |
getLong(byte[] b,
int off)
Return a long value |
static short |
getShort(byte[] b,
int off)
Return a short value |
static java.util.UUID |
getUUID(byte[] b,
int off)
Return a UUID value. |
static void |
setBoolean(byte[] b,
int off,
boolean val)
Set a boolean value |
static void |
setChar(byte[] b,
int off,
char val)
Set a char value |
static void |
setDouble(byte[] b,
int off,
double val)
Set a double value |
static void |
setFloat(byte[] b,
int off,
float val)
Set a float value |
static void |
setInt(byte[] b,
int off,
int val)
Set a integer value |
static void |
setInt3(byte[] b,
int off,
int val)
Set a integer value using only 3 bytes for storage. |
static void |
setLong(byte[] b,
int off,
long val)
Set a long value |
static void |
setShort(byte[] b,
int off,
short val)
Set a short value |
static void |
setUUID(byte[] b,
int off,
java.util.UUID val)
Set a UUID value occupying 16 bytes from the offset |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean getBoolean(byte[] b,
int off)
b - byte[]off - offset in array
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static char getChar(byte[] b,
int off)
b - byte[]off - offset in array
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static short getShort(byte[] b,
int off)
b - byte[]off - offset in array
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static int getInt(byte[] b,
int off)
b - byte[]off - offset in array
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static int getInt3(byte[] b,
int off)
This is used when the value is known not to require all four bytes and space within the stream is an issue.
b - byte[]off - offset in array
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static float getFloat(byte[] b,
int off)
b - byte[]off - offset in array
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static long getLong(byte[] b,
int off)
b - byte[]off - offset in array
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static double getDouble(byte[] b,
int off)
b - byte[]off - offset in array
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static java.util.UUID getUUID(byte[] b,
int off)
b - byte[]off - offset in array
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static void setBoolean(byte[] b,
int off,
boolean val)
b - byte[]off - offset in arrayval - value to store
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static void setChar(byte[] b,
int off,
char val)
b - byte[]off - offset in arrayval - value to store
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static void setShort(byte[] b,
int off,
short val)
b - byte[]off - offset in arrayval - value to store
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static void setInt(byte[] b,
int off,
int val)
b - byte[]off - offset in arrayval - value to store
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static void setInt3(byte[] b,
int off,
int val)
This is used when the value is known not to require all four bytes and space within the stream is an issue.
b - byte[]off - offset in arrayval - value to store
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static void setFloat(byte[] b,
int off,
float val)
b - byte[]off - offset in arrayval - value to store
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static void setLong(byte[] b,
int off,
long val)
b - byte[]off - offset in arrayval - value to store
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static void setDouble(byte[] b,
int off,
double val)
b - byte[]off - offset in arrayval - value to store
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
public static void setUUID(byte[] b,
int off,
java.util.UUID val)
b - byte[]off - offset in arrayval - value to store
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds
or there is not enough elements at offset for the value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||