|
Elexis API documentationVersion 2.1.6 as of December 11 2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.rgw.tools.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 |
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 |
byteArrayToStr(byte[] data,
int nOfs,
int nLen)
Converts a byte array into a Unicode string. |
static java.lang.String |
bytesToHexStr(byte[] data)
Converts a byte array to a hex string. |
static java.lang.String |
bytesToHexStr(byte[] data,
int nOfs,
int nLen)
Converts a byte array to a hex string. |
static int |
hexStrToBytes(java.lang.String sHex,
byte[] data,
int nSrcOfs,
int nDstOfs,
int nLen)
Converts a hex string back into a byte array (invalid codes will be skipped). |
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 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BinConverter()
Method Detail |
---|
public static final int byteArrayToInt(byte[] buf, int nOfs)
buf
- where to get the bytesnOfs
- index from where to read the data
public static final 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 final long byteArrayToLong(byte[] buf, int nOfs)
buf
- where to get the bytesnOfs
- index from where to read the data
public static final 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 final long intArrayToLong(int[] buf, int nOfs)
buf
- where to get the bytesnOfs
- index from where to read the data
public static final 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 final long makeLong(int nLo, int nHi)
nLo
- lower 32bitsnHi
- higher 32bits
public static final int longLo32(long lVal)
lVal
- the long integer
public static final int longHi32(long lVal)
lVal
- the long integer
public static final java.lang.String bytesToHexStr(byte[] data)
data
- the byte array
public static final java.lang.String bytesToHexStr(byte[] data, int nOfs, int nLen)
data
- the byte arraynOfs
- start index where to get the bytesnLen
- number of bytes to convert
public static final int hexStrToBytes(java.lang.String sHex, byte[] data, int nSrcOfs, int nDstOfs, int nLen)
sHex
- hex 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 extract
public static final java.lang.String byteArrayToStr(byte[] data, int nOfs, int nLen)
data
- the byte arraynOfs
- where to begin the conversionnLen
- number of bytes to handle
|
Elexis API documentationVersion 2.1.6 as of December 11 2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |