1.27Class Base64

Collection of methods to handle rfc3548 Base64 encoding.

Class Base64
Methods
decmbDecodes a previously encoded binary data.
decodeDecodes a previously encoded text data.
encodeTransforms an input string or MemBuf into a Base64 encoded string.

Methods

decmb

Decodes a previously encoded binary data.

Base64.decmb( data )
data The data to be decoded.
ReturnThe origianl data, as a binary sequence of bytes.
Raise
ParseError if the incoming data is not a correct base64 string.

This static method decodes the contents of the incoming data as a base64 encoded string into a binary buffer.

decode

Decodes a previously encoded text data.

Base64.decode( data )
data The data to be decoded.
ReturnThe original string (as an international text).
Raise
ParseError if the incoming data is not a correct base64 string.

This static method decodes the contents of the incoming data as a base64 encoded string into a Falcon text-oriented String.

The rfc3548 doesn't define the encoding of the input data, as base64 is a method to encode generic binary data and send them across the Internet. However, it's common practice to encode textual contents as utf-8 strings and then apply the base64 encoding.

So, this method supposes that the data, to be transformed in a string, is actually an utf-8 representation of a text. If this is not desired, use the Base64.decmb method.

encode

Transforms an input string or MemBuf into a Base64 encoded string.

Base64.encode( data )
data The data to be encoded.
ReturnThe encoded string.

This static method encodes the contents of the incoming data as a base64 encoded string.

The rfc3548 doesn't define the encoding of the input data, as base64 is a method to encode generic binary data and send them across the Internet. However, it's common practice to encode textual contents as utf-8 strings and then apply the base64 encoding.

This method automatically uses utf-8 encoding to transform strings with international characters. If this is not desired, provide a MemBuf as the parameter.

Made with http://www.falconpl.org