org.eigenbase.util14
Class ConversionUtil

java.lang.Object
  extended by org.eigenbase.util14.ConversionUtil

public class ConversionUtil
extends Object

Utility functions for converting from one type to another

Since:
Jan 22, 2006
Version:
$Id: //open/dev/farrago/src/org/eigenbase/util14/ConversionUtil.java#13 $
Author:
angel

Field Summary
static String NATIVE_UTF16_CHARSET_NAME
           
static String TEST_UNICODE_SQL_ESCAPED_LITERAL
          A constant string which can be used wherever a SQL literal containing Unicode escape characters is needed in a test.
static String TEST_UNICODE_STRING
          A constant string which can be used wherever a Java string containing Unicode characters is needed in a test.
 
Constructor Summary
ConversionUtil()
           
 
Method Summary
static Boolean toBoolean(String str)
          Converts a string into a boolean
static byte[] toByteArrayFromString(String value, int radix)
          Converts a string into a byte array.
static String toStringFromApprox(double d, boolean isFloat)
          Converts an approximate value into a string, following the SQL 2003 standard.
static String toStringFromByteArray(byte[] value, int radix)
          Converts a byte array into a bit string or a hex string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NATIVE_UTF16_CHARSET_NAME

public static final String NATIVE_UTF16_CHARSET_NAME

TEST_UNICODE_STRING

public static final String TEST_UNICODE_STRING
A constant string which can be used wherever a Java string containing Unicode characters is needed in a test. It spells 'anthropos' in Greek.

See Also:
Constant Field Values

TEST_UNICODE_SQL_ESCAPED_LITERAL

public static final String TEST_UNICODE_SQL_ESCAPED_LITERAL
A constant string which can be used wherever a SQL literal containing Unicode escape characters is needed in a test. It spells 'anthropos' in Greek. The escape character is the SQL default (backslash); note that the backslash-doubling here is for Java only, so by the time the SQL parser gets it, there is only one backslash.

See Also:
Constant Field Values
Constructor Detail

ConversionUtil

public ConversionUtil()
Method Detail

toStringFromByteArray

public static String toStringFromByteArray(byte[] value,
                                           int radix)
Converts a byte array into a bit string or a hex string.

For example, toStringFromByteArray(new byte[] {0xAB, 0xCD}, 16) returns ABCD.


toByteArrayFromString

public static byte[] toByteArrayFromString(String value,
                                           int radix)
Converts a string into a byte array. The inverse of toStringFromByteArray(byte[], int).


toStringFromApprox

public static String toStringFromApprox(double d,
                                        boolean isFloat)
Converts an approximate value into a string, following the SQL 2003 standard.


toBoolean

public static Boolean toBoolean(String str)
Converts a string into a boolean