info.fingo.util
Class Converter

java.lang.Object
  extended by info.fingo.util.Converter

public class Converter
extends java.lang.Object

Utility class with methods for converting binary values to strings for the use of MS SQL Server GUID fields

Author:
FINGO - Jan Wielgus

Constructor Summary
Converter()
           
 
Method Summary
static java.lang.String byteArrayToHexString(byte[] in)
          Converts the given byte array to a hexadecimal string
static java.lang.String formatSQLServerGUID(java.lang.String guid)
          Converts the given hexadecimal string to the MS SQL Server format
static byte[] hexStringToByteArray(java.lang.String str)
          Converts the given hexadecimal string to a byte array
static byte[] invertSQLServerByteArray(byte[] arr)
          Inverts the first three blocks of bytes in a byte array (needed for SQL Server)
static void reverseByteArray(byte[] b)
           
static java.lang.String unformatSQLServerGUID(java.lang.String guid)
          Converts a hexadecimal GUID string in MS SQL Server style to a typical hexadecimal string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Converter

public Converter()
Method Detail

byteArrayToHexString

public static java.lang.String byteArrayToHexString(byte[] in)
Converts the given byte array to a hexadecimal string

Parameters:
in - the byte array to be converted
Returns:
The returned hexadecimal string

hexStringToByteArray

public static byte[] hexStringToByteArray(java.lang.String str)
Converts the given hexadecimal string to a byte array

Parameters:
str - The string to be converted
Returns:
The returned byte array

unformatSQLServerGUID

public static java.lang.String unformatSQLServerGUID(java.lang.String guid)
Converts a hexadecimal GUID string in MS SQL Server style to a typical hexadecimal string

Parameters:
guid - GUID value in MS SQL Server format
Returns:
The returned hexadecimal string

formatSQLServerGUID

public static java.lang.String formatSQLServerGUID(java.lang.String guid)
Converts the given hexadecimal string to the MS SQL Server format

Parameters:
guid - The hexadecimal string to be formatted
Returns:
The formatted GUID string

invertSQLServerByteArray

public static byte[] invertSQLServerByteArray(byte[] arr)
Inverts the first three blocks of bytes in a byte array (needed for SQL Server)

Parameters:
arr - The byte array to be inverted
Returns:
The inverted array

reverseByteArray

public static void reverseByteArray(byte[] b)
Parameters:
b -