Internet Direct (Indy) Version 9.0.1 Beta
TIdEncoder.Encode
Provides encoding for String- or Stream-based input values.

function Encode(const ASrc: string): string; overload;
function Encode(ASrcStream: TStream; const ABytes: integer): string; virtual; abstract; overload;
Parameters
const ASrc: string
Stream-based values to be encoded.

Returns
String - Encoded value for the input parameter(s).

Description
Encode is an overloaded String function in TIdEncoder that allows String- or Stream-based input values to be encoded. The encoded value of the input parameter is the return value for the function.

ASrc contains the un-encoded valued to be used by the function. In the Stream-based variant, ASrcStream contains the un-encoded input values. ABytes represents the number of bytes in ASrcStream to be affected by the encoding operation. When ommitted, ABytes defaults to the constant value MaxInt, and allows the function to read up to MaxInt byte values or until the end of the Stream is reached.

The Stream-based variant of Encode is a virtual function in TIdEncoder, and allows descendant classes to reimplement the function using specific encoding algorithms.

Encode is called by the class function EncodeString, when no application instance of TIdEncoder is required or available.