|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.yajul.util.Bytes
public class Bytes
Yet another class that turns Java primatives into arrays of bytes, and back. User: josh Date: Jan 11, 2004 Time: 10:18:58 PM
Field Summary | |
---|---|
static byte[] |
HEX_BYTES_LOWER
Lowercase hex characters as bytes. |
static byte[] |
HEX_BYTES_UPPER
Uppercase hex characters as bytes. |
static char[] |
HEX_CHARS_LOWER
Lowercase hex characters. |
static char[] |
HEX_CHARS_UPPER
Uppercase hex characters. |
static java.lang.String |
HEX_LOWER
|
static java.lang.String |
HEX_UPPER
|
static int |
MASK
Lower nybble mask. |
static int |
VALUE_LOWERCASE_A
|
static int |
VALUE_UPPERCASE_A
|
Constructor Summary | |
---|---|
Bytes()
|
Method Summary | |
---|---|
static void |
hexBytes(byte[] hexBytes,
byte[] inBytes,
byte[] out,
int length)
Converts the byte into a two element array of hex characters. |
static void |
hexBytes(byte[] hexBytes,
int inByte,
byte[] out)
Converts the byte into a two element array of hex characters. |
static byte[] |
parseHex(java.lang.String hexString)
Parses a hex string into an array of bytes. |
static byte[] |
toBytes(int n,
byte[] b)
Builds a 4-byte array from an int, MSB first. |
static byte[] |
toBytes(long n,
byte[] b)
Builds a 8-byte array from an int, MSB first. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int VALUE_UPPERCASE_A
public static final int VALUE_LOWERCASE_A
public static final java.lang.String HEX_LOWER
public static final java.lang.String HEX_UPPER
public static final char[] HEX_CHARS_LOWER
public static final char[] HEX_CHARS_UPPER
public static final byte[] HEX_BYTES_LOWER
public static final byte[] HEX_BYTES_UPPER
public static final int MASK
Constructor Detail |
---|
public Bytes()
Method Detail |
---|
public static byte[] toBytes(int n, byte[] b)
n
- The number to convert.b
- The output array.
public static byte[] toBytes(long n, byte[] b)
n
- The number to convert.b
- The output array.
public static void hexBytes(byte[] hexBytes, byte[] inBytes, byte[] out, int length)
hexBytes
- The hex encoding set to use (e.g. HEX_BYTES_LOWER /
HEX_BYTES_UPPER).inBytes
- The input byte array.length
- The number of bytes to convert to hex.out
- The output array of hex bytes. The length of this array
must be >= 2 * length.public static void hexBytes(byte[] hexBytes, int inByte, byte[] out)
hexBytes
- The hex character set to use (e.g. HEX_BYTES_LOWER / HEX_BYTES_UPPER).inByte
- The input byte.out
- The output array of characters. Length must be >= 2.public static byte[] parseHex(java.lang.String hexString)
hexString
- the hex string
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |