Class BinaryValue

java.lang.Object
dev.frostlake.values.BinaryValue
All Implemented Interfaces:
Serializable, Comparable<BinaryValue>

public final class BinaryValue extends Object implements Comparable<BinaryValue>, Serializable
Runtime value of the SQL BINARY type: an immutable byte sequence.

Engine cells historically carried BINARY as encoded text (uppercase hex or base64 depending on the producer). This class replaces that with real bytes. toString() is the canonical uppercase-hex display form with no 0x prefix — the Snowflake result rendering — so any boundary that stringifies a cell keeps producing the documented output. Equality is byte equality, and ordering is unsigned lexicographic over the bytes, which coincides with the lexicographic order of the uppercase-hex form.

See Also:
  • Method Details

    • of

      public static BinaryValue of(byte[] bytes)
      Wraps bytes as a BINARY value; the caller hands over ownership of the array.
    • fromHex

      public static BinaryValue fromHex(String hex)
      Decodes a hex string. There is no 0x prefix: Snowflake's decoder does not know one, and refuses '0x48656C6C6F' with the same sentence it gives any other non-hex text — from a ::BINARY cast, from TO_BINARY and from HEX_DECODE_BINARY alike. Frostlake used to strip it, so it read a spelling no account accepts. (X'48656C6C6F' is unaffected: the literal's own syntax carries the marker, and the text inside it is bare hex.)
    • fromBase64

      public static BinaryValue fromBase64(String base64)
    • bytes

      public byte[] bytes()
      The underlying bytes. Callers must not mutate the returned array.
    • length

      public int length()
    • toHex

      public String toHex()
    • toBase64

      public String toBase64()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(BinaryValue other)
      Specified by:
      compareTo in interface Comparable<BinaryValue>