|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--BlowfishJ.BinConverter
some helper routines for data conversion, all data is treated in network byte order
Constructor Summary | |
BinConverter()
|
Method Summary | |
static int |
binHexToBytes(java.lang.String sBinHex,
byte[] data,
int nSrcOfs,
int nDstOfs,
int nLen)
Converts a binhex string back into a byte array (invalid codes will be skipped). |
static int |
byteArrayToInt(byte[] buf,
int nOfs)
Gets bytes from an array into an integer. |
static long |
byteArrayToLong(byte[] buf,
int nOfs)
Gets bytes from an array into a long. |
static java.lang.String |
byteArrayToUNCString(byte[] data,
int nOfs,
int nLen)
Converts a byte array into an Unicode string. |
static java.lang.String |
bytesToBinHex(byte[] data)
Converts a byte array to a binhex string. |
static java.lang.String |
bytesToBinHex(byte[] data,
int nOfs,
int nLen)
Converts a byte array to a binhex string. |
static long |
intArrayToLong(int[] buf,
int nOfs)
Converts values from an integer array to a long. |
static void |
intToByteArray(int nValue,
byte[] buf,
int nOfs)
Converts an integer to bytes, which are put into an array. |
static int |
longHi32(long lVal)
Gets the higher 32 bits of a long. |
static int |
longLo32(long lVal)
Gets the lower 32 bits of a long. |
static void |
longToByteArray(long lValue,
byte[] buf,
int nOfs)
Converts a long to bytes, which are put into an array. |
static void |
longToIntArray(long lValue,
int[] buf,
int nOfs)
Converts a long to integers which are put into an array. |
static long |
makeLong(int nLo,
int nHi)
Makes a long from two integers (treated unsigned). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BinConverter()
Method Detail |
public static int byteArrayToInt(byte[] buf, int nOfs)
buf
- where to get the bytesnOfs
- index from where to read the datapublic static void intToByteArray(int nValue, byte[] buf, int nOfs)
nValue
- the 32bit integer to convertbuf
- the target bufnOfs
- where to place the bytes in the bufpublic static long byteArrayToLong(byte[] buf, int nOfs)
buf
- where to get the bytesnOfs
- index from where to read the datapublic static void longToByteArray(long lValue, byte[] buf, int nOfs)
lValue
- the 64bit integer to convertbuf
- the target bufnOfs
- where to place the bytes in the bufpublic static long intArrayToLong(int[] buf, int nOfs)
buf
- where to get the bytesnOfs
- index from where to read the datapublic static void longToIntArray(long lValue, int[] buf, int nOfs)
lValue
- the 64bit integer to convertbuf
- the target bufnOfs
- where to place the bytes in the bufpublic static long makeLong(int nLo, int nHi)
nLo
- lower 32bitsnHi
- higher 32bitspublic static int longLo32(long lVal)
lVal
- the long integerpublic static int longHi32(long lVal)
lVal
- the long integerpublic static java.lang.String bytesToBinHex(byte[] data)
data
- the byte arraypublic static java.lang.String bytesToBinHex(byte[] data, int nOfs, int nLen)
data
- the byte arraynOfs
- start index where to get the bytesnLen
- number of bytes to convertpublic static int binHexToBytes(java.lang.String sBinHex, byte[] data, int nSrcOfs, int nDstOfs, int nLen)
sBinHex
- binhex stringdata
- the target arraynSrcOfs
- from which character in the string the conversion should begin,
remember that (nSrcPos modulo 2) should equals 0 normallynDstOfs
- to store the bytes from which position in the arraynLen
- number of bytes to extractpublic static java.lang.String byteArrayToUNCString(byte[] data, int nOfs, int nLen)
data
- the byte arraynOfs
- where to begin the conversionnLen
- number of bytes to handle
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |