public final class BinConverter extends Object
Constructor and Description |
---|
BinConverter() |
Modifier and Type | Method and Description |
---|---|
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)
|
public BinConverter()
public static long byteArrayToLong(byte[] buffer, int nStartIndex)
buffer
- where to get the bytesnStartIndex
- index from where to read the datapublic 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 datapublic 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 32bitspublic static int longLo32(long lVal)
lVal
- the long integerpublic static int longHi32(long lVal)
lVal
- the long integerpublic static String bytesToBinHex(byte[] data)
data
- the byte arraypublic static String bytesToBinHex(byte[] data, int nStartPos, int nNumOfBytes)
data
- the byte arraynStartPos
- start index where to get the bytesnNumOfBytes
- number of bytes to convertpublic 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 extractpublic static String byteArrayToUNCString(byte[] data, int nStartPos, int nNumOfBytes)
data
- the byte arraynStartPos
- where to begin the conversionnNumOfBytes
- number of bytes to handleCopyright © 2015 Lucee