|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gridbus.broker.util.Conversion
public class Conversion
This class contains some methods for conversion of byte arrays, hex values etc.
Constructor Summary | |
---|---|
Conversion()
|
Method Summary | |
---|---|
static byte[] |
bigIntegerToUnsigedBytes(java.math.BigInteger b)
Converts a BigInteger to a byte array. |
static java.lang.String |
byteArrayToString(byte[] in,
java.lang.String encoding)
Use if you don't want to have to catch a million UnsupportedEncodingExceptions. |
static java.lang.String |
bytesToHexString(byte[] inByteArray)
Converts a byte[] array into a Hex string |
static java.lang.String |
bytesToHexString(byte[] inByteArray,
int offset,
int len)
Converts the given byte array into a hex string representation. |
static int |
bytesToInt(byte[] bytes)
This function accepts a number of bytes and returns an integer. |
static long |
bytesToLong(byte[] bytes)
This function accepts a number of bytes and returns a long integer. |
static byte[] |
hexStringToBytes(java.lang.String str)
This method accepts a hex string and returns a byte array. |
static byte[] |
intToBytes(int i)
Converts a integer to a byte array representation. |
static void |
longToBytes(long l,
byte[] b,
int offset,
int len)
Converts a long integer to a byte array representation. |
static byte[] |
longToBytes(long l,
int len)
Converts a long integer to a byte array representation. |
static byte[] |
stringToByteArray(java.lang.String in,
java.lang.String encoding)
Use if you don't want to have to catch a million UnsupportedEncodingExceptions. |
static int |
unsignedByteToInt(byte i)
Converts a byte in range -128 <= i <= 127 to an int in range 0 <= i <= 255. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Conversion()
Method Detail |
---|
public static java.lang.String bytesToHexString(byte[] inByteArray)
inByteArray
-
public static java.lang.String bytesToHexString(byte[] inByteArray, int offset, int len)
inByteArray
- offset
- len
-
public static long bytesToLong(byte[] bytes)
bytes
- the byte array to convert to a long integer representation.
public static int bytesToInt(byte[] bytes)
bytes
- the byte array to convert to a long integer representation.
public static byte[] hexStringToBytes(java.lang.String str)
str
- - the hex string to convert to byte array representation.
public static byte[] intToBytes(int i)
i
- the integer to convert to byte array representation.
public static byte[] longToBytes(long l, int len)
l
- the long integer to convert to byte array representation.len
- the size of the byte array to return
public static void longToBytes(long l, byte[] b, int offset, int len)
l
- the long integer to convert to byte array representation.b
- offset
- len
- the size of the byte array to returnpublic static int unsignedByteToInt(byte i)
i
- the byte to convert
public static byte[] stringToByteArray(java.lang.String in, java.lang.String encoding)
in
- encoding
-
public static java.lang.String byteArrayToString(byte[] in, java.lang.String encoding)
in
- encoding
-
public static byte[] bigIntegerToUnsigedBytes(java.math.BigInteger b)
b
- the java.math.BigInteger to convert to a byte array
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |