net.sf.opensmus
Class ConversionUtils

java.lang.Object
  extended by net.sf.opensmus.ConversionUtils

public class ConversionUtils
extends java.lang.Object

Collection of static methods for data conversion. Data is treated in network byte order. This class is reserved for internal use of OpenSMUS


Constructor Summary
ConversionUtils()
           
 
Method Summary
static int binHexToBytes(java.lang.String sBinHex, byte[] data, int nSrcPos, int nDstPos, int nNumOfBytes)
           
static int byteArrayToInt(byte[] buffer, int nStartIndex)
           
static long byteArrayToLong(byte[] buffer, int nStartIndex)
           
static short byteArrayToShort(byte[] buffer, int nStartIndex)
           
static java.lang.String byteArrayToUNCString(byte[] data, int nStartPos, int nNumOfBytes)
           
static java.lang.String bytesToBinHex(byte[] data)
           
static java.lang.String bytesToBinHex(byte[] data, int nStartPos, int nNumOfBytes)
           
static long intArrayToLong(int[] buffer, int nStartIndex)
           
static java.lang.String intToBinHex(int lValue)
           
static void intToByteArray(int lValue, byte[] buffer, int nStartIndex)
           
static int longHi32(long lVal)
           
static int longLo32(long lVal)
           
static java.lang.String longToBinHex(long lValue)
           
static void longToByteArray(long lValue, byte[] buffer, int nStartIndex)
           
static void longToIntArray(long lValue, int[] buffer, int nStartIndex)
           
static long makeLong(int nLo, int nHi)
           
static void shortToByteArray(int lValue, byte[] buffer, int nStartIndex)
           
static int swapIntBytes(int lValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversionUtils

public ConversionUtils()
Method Detail

byteArrayToLong

public static long byteArrayToLong(byte[] buffer,
                                   int nStartIndex)

byteArrayToInt

public static int byteArrayToInt(byte[] buffer,
                                 int nStartIndex)

byteArrayToShort

public static short byteArrayToShort(byte[] buffer,
                                     int nStartIndex)

longToByteArray

public static void longToByteArray(long lValue,
                                   byte[] buffer,
                                   int nStartIndex)

swapIntBytes

public static int swapIntBytes(int lValue)

intToByteArray

public static void intToByteArray(int lValue,
                                  byte[] buffer,
                                  int nStartIndex)

shortToByteArray

public static void shortToByteArray(int lValue,
                                    byte[] buffer,
                                    int nStartIndex)

intArrayToLong

public static long intArrayToLong(int[] buffer,
                                  int nStartIndex)

longToIntArray

public static void longToIntArray(long lValue,
                                  int[] buffer,
                                  int nStartIndex)

makeLong

public static long makeLong(int nLo,
                            int nHi)

longLo32

public static int longLo32(long lVal)

longHi32

public static int longHi32(long lVal)

bytesToBinHex

public static java.lang.String bytesToBinHex(byte[] data)

longToBinHex

public static java.lang.String longToBinHex(long lValue)

intToBinHex

public static java.lang.String intToBinHex(int lValue)

bytesToBinHex

public static java.lang.String bytesToBinHex(byte[] data,
                                             int nStartPos,
                                             int nNumOfBytes)

binHexToBytes

public static int binHexToBytes(java.lang.String sBinHex,
                                byte[] data,
                                int nSrcPos,
                                int nDstPos,
                                int nNumOfBytes)

byteArrayToUNCString

public static java.lang.String byteArrayToUNCString(byte[] data,
                                                    int nStartPos,
                                                    int nNumOfBytes)