|
Luky Library - 4.1.1 (20061117-1148) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectluky.crypt.BinConverter
public class BinConverter
some helper routines for data conversion, all data is treated in network byte order
Constructor Summary | |
---|---|
BinConverter()
|
Method Summary | |
---|---|
static int |
binHexToBytes(String sBinHex,
byte[] data,
int nSrcPos,
int nDstPos,
int nNumOfBytes)
converts a binhex string back into a byte array (invalid codes will be skipped) |
static long |
byteArrayToLong(byte[] buffer,
int nStartIndex)
gets bytes from an array into a long |
static String |
byteArrayToUNCString(byte[] data,
int nStartPos,
int nNumOfBytes)
converts a byte array into an UNICODE string |
static String |
bytesToBinHex(byte[] data)
converts a byte array to a binhex string |
static String |
bytesToBinHex(byte[] data,
int nStartPos,
int nNumOfBytes)
converts a byte array to a binhex string |
static long |
intArrayToLong(int[] buffer,
int nStartIndex)
converts values from an integer array to a long |
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[] buffer,
int nStartIndex)
converts a long o bytes which are put into a given array |
static void |
longToIntArray(long lValue,
int[] buffer,
int nStartIndex)
converts a long to integers which are put into a given 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 long byteArrayToLong(byte[] buffer, int nStartIndex)
buffer
- where to get the bytesnStartIndex
- index from where to read the data
public static void longToByteArray(long lValue, byte[] buffer, int nStartIndex)
lValue
- the 64bit integer to convertbuffer
- the target buffernStartIndex
- where to place the bytes in the bufferpublic static long intArrayToLong(int[] buffer, int nStartIndex)
buffer
- where to get the bytesnStartIndex
- index from where to read the data
public static void longToIntArray(long lValue, int[] buffer, int nStartIndex)
lValue
- the 64bit integer to convertbuffer
- the target buffernStartIndex
- where to place the bytes in the bufferpublic static long makeLong(int nLo, int nHi)
nLo
- lower 32bitsnHi
- higher 32bits
public static int longLo32(long lVal)
lVal
- the long integer
public static int longHi32(long lVal)
lVal
- the long integer
public static String bytesToBinHex(byte[] data)
data
- the byte array
public static String bytesToBinHex(byte[] data, int nStartPos, int nNumOfBytes)
data
- the byte arraynStartPos
- start index where to get the bytesnNumOfBytes
- number of bytes to convert
public static int binHexToBytes(String sBinHex, byte[] data, int nSrcPos, int nDstPos, int nNumOfBytes)
sBinHex
- binhex stringdata
- the target arraynSrcPos
- from which character in the string the conversion should begin,
remember that (nSrcPos modulo 2) should equals 0 normallynDstPos
- to store the bytes from which position in the arraynNumOfBytes
- number of bytes to extract
public static String byteArrayToUNCString(byte[] data, int nStartPos, int nNumOfBytes)
data
- the byte arraynStartPos
- where to begin the conversionnNumOfBytes
- number of bytes to handle
|
Luky Library - 4.1.1 (20061117-1148) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |