Package dev.frostlake.values
Class BinaryValue
java.lang.Object
dev.frostlake.values.BinaryValue
- All Implemented Interfaces:
Serializable,Comparable<BinaryValue>
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 Summary
Modifier and TypeMethodDescriptionbyte[]bytes()The underlying bytes.intcompareTo(BinaryValue other) booleanstatic BinaryValuefromBase64(String base64) static BinaryValueDecodes a hex string.inthashCode()intlength()static BinaryValueof(byte[] bytes) Wrapsbytesas a BINARY value; the caller hands over ownership of the array.toBase64()toHex()toString()
-
Method Details
-
of
Wrapsbytesas a BINARY value; the caller hands over ownership of the array. -
fromHex
Decodes a hex string. There is no0xprefix: Snowflake's decoder does not know one, and refuses'0x48656C6C6F'with the same sentence it gives any other non-hex text — from a::BINARYcast, fromTO_BINARYand fromHEX_DECODE_BINARYalike. 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
-
bytes
public byte[] bytes()The underlying bytes. Callers must not mutate the returned array. -
length
public int length() -
toHex
-
toBase64
-
toString
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<BinaryValue>
-