/MEng/System/Runtime/Base64

ClassPath:MEng.System.Runtime.Base64
Parent ClassPath:MEng.Object
Copyable:No
Final:Yes

MEng.System.Runtime.Base64 supports encoding to and decoding from the simple Base64 format, which is commonly used in the various network protocols. It can encode data into a format that can be passed through any protocol that can support the ASCII character set, and uses no characters that would cause ambiguities if a block of Base64 encoded data is used as element text in an HTML or XML document.

 

Nested Types:

Enum=B64Errors
    Encode     : "";
    Decode     : "";
EndEnum;

This enumeration represents the exceptions that this class defines. Some don't have any associated text since the text will be gotten from the underlying C++ error that occurred.

 

Constructors:

Constructor();

There is just a default constructor available.

 

Final, Const Methods:

DecodeToBuf([In] MEng.String B64Text, [Out] MEng.Runtime.MemBuf ToFill) Returns MEng.Card4;

Given a string of base 64 encoded text, this method will decode that string and recover the original bytes, placing them into the ToFill memory buffer object. It returns the number of bytes that were placed into the buffer. If any error occurs, the Decode exception will be thrown.

EncodeBuf
(
    [In]   MEng.Runtime.MemBuf SrcData
    , [In] Card4 ByteCnt
    , [Out] MEng.String ToFill
)   Returns MEng.Card4;

Given a buffer of source data, which contains ByteCnt bytes, this method will encode the source buffer into base 64 format and place the results into the string, ToFill. If any error occurs, the Encode exception will be thrown.

EncodeStr(In] MEng.String SrcData[Out], MEng.String ToFill);

Given a string of data, this method will encode the text into base 64 and place the result into the string, ToFill. If any error occurs, the Encode exception will be thrown.

Note that this method knows nothing of text encoding formats. It assumes that the source data is ASCII, or at worse that it is a single byte encoding such as the ISO-8859-x type encodings. So it will grab the low byte of each Unicode character and encode it.  If you need to encode text where the source is in a particular encoding, then use a text transcoder object (TextXCoder class), to transcode the Unicode based string text into a memory buffer, then use EncodeBuf to encode it. This method is just a convenience for encoding ASCII text (often required for various network protocols.)