Lyric v4.5.0

std.encoding

EncodingError class

pub class EncodingError :: [Throwable]

Where and why a text was refused: the 0-based character offset of the refusal, and what the decoder expected there.

offset: int
expected: string
pub fn message(): string

stdlib/std/encoding.lyr:22

hexEncode function

pub fn hexEncode(bytes: uint8[]): string

Bytes as lowercase hexadecimal, two characters per byte, no separators. Empty bytes are the empty string.

stdlib/std/encoding.lyr:69

hexDecode function

pub fn hexDecode(text: string): ?uint8[]

The bytes a hexadecimal string spells, or null when it spells none: an odd length or a character outside 0-9, a-f, A-F. The empty string is an empty array.

stdlib/std/encoding.lyr:83

hexDecodeOrThrow function

pub fn hexDecodeOrThrow(text: string): uint8[] throws EncodingError

hexDecode, with the reason when the text spells no bytes: where it broke, and what a hexadecimal string would have had there.

stdlib/std/encoding.lyr:89

base64Encode function

pub fn base64Encode(bytes: uint8[]): string

Bytes as base64 (RFC 4648 §4: A-Za-z0-9+/), padded with = to a multiple of four characters. Empty bytes are the empty string.

stdlib/std/encoding.lyr:124

base64Decode function

pub fn base64Decode(text: string): ?uint8[]

The bytes a base64 string spells, or null when it spells none. Strict: the length must be a multiple of four, = may appear only as the final one or two characters, characters outside the alphabet are refused, and so is padding whose unused bits are not zero — accepted input is exactly what base64Encode produces. The empty string is an empty array.

stdlib/std/encoding.lyr:172

base64DecodeOrThrow function

pub fn base64DecodeOrThrow(text: string): uint8[] throws EncodingError

base64Decode, with the reason when the text spells no bytes: where it broke, and what a base64 string would have had there.

stdlib/std/encoding.lyr:178