Indy 9
|
TIdEncoder3to4 = class(TIdEncoder)
TIdEncoder3to4 provides a coding table to represent the valid characters in the encoder alphabet. Note: TIdEncoder3to4 does not specify the valid characters in the coding table. Application will generally use a descendant class, like TIdCoderMIME or TIdCoderUUE, where the alphabet is specified.
TIdEncoder3to4 represents 3-byte input values as 4 concatenated 6-bit groups, each of which is translated into a single valid character in the encoder coding table.
Special processing is performed to ensure that data to be encoded is a multiple of 3-bytes. When fewer than 3 bytes are available, a user-definable fill character is used to pad input data to the required length.
property CodingTable: string;
property FillChar: Char;
function Encode(ASrcStream: TStream; const ABytes: Integer = MaxInt): string; override;
ASrcStream represent a TStream descendant that contains the values to be encoded. Note: Encode does not reset the position of ASrcStream prior to or following the process of reading values from the stream.
ABytes is an Integer that represents the number of bytes in ASrcStream to be encoded. The default value for ABytes is MaxInt. If a value other than MaxInt is specified, ABytes must be a multiple of 3 or an EIdException will be raised with the RSUnevenSizeInEncodeStream message. When ABytes contains the value MaxInt, the user-defined FillChar will be appended to the input stream until the length is the required 3 bytes.
Encode calls the EncodeUnit method using the 3 bytes values read from the stream to generate the encoded value written to the result String.
procedure EncodeUnit(const AIn1: Byte; const AIn2: Byte; const AIn3: Byte; var VOut: Cardinal);
EncodeUnit is called repeatedly from Encode as inoput values are read from a stream.