Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## superwaba.ext.xplat.util.crypto
Class BinConverter

    java.lang.Object
      |
      +--superwaba.ext.xplat.util.crypto.BinConverter

public class BinConverter
extends Object

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
`equals, getClass, hashCode, notify, toString, wait, wait`

Constructor Detail

### BinConverter

    public BinConverter()

Method Detail

### byteArrayToLong

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

  gets bytes from an array into a long
  Parameters:
    `buffer` - where to get the bytes
    `nStartIndex` - index from where to read the data
  Returns:
    the 64bit integer

### longToByteArray

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

  converts a long o bytes which are put into a given array
  Parameters:
    `lValue` - the 64bit integer to convert
    `buffer` - the target buffer
    `nStartIndex` - where to place the bytes in the buffer

### intArrayToLong

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

  converts values from an integer array to a long
  Parameters:
    `buffer` - where to get the bytes
    `nStartIndex` - index from where to read the data
  Returns:
    the 64bit integer

### longToIntArray

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

  converts a long to integers which are put into a given array
  Parameters:
    `lValue` - the 64bit integer to convert
    `buffer` - the target buffer
    `nStartIndex` - where to place the bytes in the buffer

### makeLong

    public static long makeLong(int nLo,
                                int nHi)

  makes a long from two integers (treated unsigned)
  Parameters:
    `nLo` - lower 32bits
    `nHi` - higher 32bits
  Returns:
    the built long

### longLo32

    public static int longLo32(long lVal)

  gets the lower 32 bits of a long
  Parameters:
    `lVal` - the long integer
  Returns:
    lower 32 bits

### longHi32

    public static int longHi32(long lVal)

  gets the higher 32 bits of a long
  Parameters:
    `lVal` - the long integer
  Returns:
    higher 32 bits

### bytesToBinHex

    public static String bytesToBinHex(byte[] data)

  converts a byte array to a binhex string
  Parameters:
    `data` - the byte array
  Returns:
    the binhex string

### bytesToBinHex

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

  converts a byte array to a binhex string
  Parameters:
    `data` - the byte array
    `nStartPos` - start index where to get the bytes
    `nNumOfBytes` - number of bytes to convert
  Returns:
    the binhex string

### binHexToBytes

    public 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)
  Parameters:
    `sBinHex` - binhex string
    `data` - the target array
    `nSrcPos` - from which character in the string the conversion should begin, remember that (nSrcPos modulo 2) should equals 0 normally
    `nDstPos` - to store the bytes from which position in the array
    `nNumOfBytes` - number of bytes to extract
  Returns:
    number of extracted bytes

### byteArrayToUNCString

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

  converts a byte array into an UNICODE string
  Parameters:
    `data` - the byte array
    `nStartPos` - where to begin the conversion
    `nNumOfBytes` - number of bytes to handle
  Returns:
    the string

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD