module
Crowbar::Encoding
Overview
Binary Input and Output Representation Codecs. Provides transparent conversion between human-friendly CLI string encodings (hexadecimal, C-escapes, bitstrings, base64) and raw binary buffers.
Defined in:
crowbar/encoding.crClass Method Summary
-
.decode(input : String | Bytes | Buffer, format : Format | String | Symbol = Format::Raw) : Buffer
Decodes an input string, bytes, or buffer into a raw binary Buffer
-
.decode_base64(str : String) : Buffer
Decodes Base64 strings to raw binary Buffer
-
.decode_bit(str : String) : Buffer
Decodes bitstring representations (e.g.
-
.decode_escape(str : String) : Buffer
Decodes C-style escape representations (e.g.
-
.decode_hex(str : String) : Buffer
Decodes hexadecimal string representations (e.g.
-
.detect(input : String) : Format
Auto-detects the most probable encoding of an input string representation
-
.encode(buffer : Buffer | Bytes, format : Format | String | Symbol = Format::Raw) : String
Encodes a binary buffer into the requested string representation
Class Method Detail
Decodes an input string, bytes, or buffer into a raw binary Buffer
Decodes bitstring representations (e.g. "0b01010100 01110010" or "0101010001110010")
Decodes C-style escape representations (e.g. "\x64\xaf\x00\r\n\t")
Decodes hexadecimal string representations (e.g. "414243", "0x41 0x42", "41:42:43")
Auto-detects the most probable encoding of an input string representation