klyn.databases.sql.postgresql.PostgreSQLSupport.decodeBytea
method
public static decodeBytea(raw as String) as Byte[]
Description

Decodes PostgreSQL bytea text in hex or legacy escaped-octal format.

Parameters
ParameterDescription
rawServer text, or null for SQL NULL.
Returns

Exact binary bytes; empty bytea is distinct from null.

Throws
  • SQLException For a malformed hex pair or escape sequence.
Example
bytes = PostgreSQLSupport.decodeBytea("\\x0041ff")
assert bytes[0] == Byte(0) and bytes[2] == Byte(255)