Class ConversionUtil

java.lang.Object
org.apache.calcite.util.ConversionUtil

public class ConversionUtil extends Object
Utility functions for converting from one type to another.
  • Field Details

    • 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:
    • 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:
  • Method Details

    • 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 @Nullable Boolean toBoolean(@Nullable String str)
      Converts a string into a BOOLEAN.