Indy 9
TIdDecoder4to3
Hierarchy, Properties, Methods, See Also, Unit: IdCoder3To4
Implements a decoder using a table-driven alphabet to produce output represented in the US-ASCII character set.
TIdDecoder4to3 = class(TIdDecoder)
Unit
IdCoder3To4
Description
TIdDecoder4to3 is a TIdDecoder descendant that implements decoding capabilities for data encoded using TIdEncoder3to4. TIdDecoder4to3 provides a decoding table to represent the valid characters in the encoder alphabet. Note: TIdDecoder4to3 does not specify the valid characters in the decoding table. Application will generally use a descendant class, like TIdDeCoderMIME or TIdDecoderUUE, where the alphabet is specified.

TIdDecoder4to3 provides methods to decode string values to as stream destination, and method to handle the low-level conversion performed when processing string input values.


TIdDecoder4to3.FillChar
TIdDecoder4to3, See Also
Indicates a character value that can be omitted from decoded output.
property FillChar: Char;
Description
FillChar is a Char property that Indicates a character value that can be omitted from decoded output. FillChar should correspond to the value that may have been added by TIdEncoder3to4 the encoded output to force to the length required by TIdEncoder3to4.Encode.

TIdDecoder4to3.ConstructDecodeTable
TIdDecoder4to3, See Also, Example
Initializes the coding table used by the decoder.
class procedure ConstructDecodeTable(const ACodingTable: string; var ADecodeArray: TIdDecodeTable);
Parameters
const ACodingTable: string
String containing the initial coder alphabet.
var ADecodeArray: TIdDecodeTable
Table used by the decoder to detect valid characters and ordinal position.
Description
ConstructDecodeTable is a Class procedure that initializes the CodingTable used by TIdDecoder4to3. All elements in ADecoderArray are initialize to decimal 255, and the valid characters in ACodingTable are overlaid to indicate their ordinal position in the coder alphabet.

ADecodeArray is used by descendant classes, like TIdDecoderMIME and TIdDecoderUUE, to initialize their DecodeTable properties based on the alphabet for each specific coder.


TIdDecoder4to3.DecodeToStream
TIdDecoder4to3, See Also
Implements the TIdDecoder4to3 decoding algorithm for decoding String values to a Stream.
procedure DecodeToStream(AIn: string; ADest: TStream); override;
Parameters
AIn: string
Value to be decoded.
ADest: TStream
Stream that is the destination for the decoded value.
Description
DecodeToStream is an overridden procedure in TIdDecoder4to3 that implements decoding the String value in AIn to the TStream destination in ADest. DecodeToStream implements a decoding algorithm that converts the 4-byte representation of encoded data to it's 3-byte un-encoded representation.

DecodeToStream can raise an EIdException with the constant message RSUnevenSizeInDecodeStream when the length of the encoded data in AIn is not a multiple of 4.

DecodeToStream reads 4 bytes of data from AIn and calls DecodeUnit until all contents in the encoded data have been handled. An individual byte in the 3-byte un-encoded value and it's preceding byte will be omitted when the byte value is equal to FillChar.


TIdDecoder4to3.DecodeUnit
TIdDecoder4to3, See Also
Performs the specifics of the TIdDecoder4to3 decoding algorithm.
procedure DecodeUnit(AIn: Cardinal; var VOut1: Byte; var VOut2: Byte; var VOut3: Byte);
Parameters
AIn: Cardinal
Cardinal value of the encoded data.
var VOut1: Byte
value of Byte 1 in the un-encoded data.
var VOut2: Byte
value of Byte 2 in the un-encoded data.
var VOut3: Byte
value of Byte 3 in the un-encoded data.
Description
DecodeUnit is a procedure that implements the specific processing required to perform the TIdDecoder4to3 decoding algorithm. AIn is the Cardinal value of the encoded data. DecodeUnit create an instance of TIdCardinalBytes used to concatenate the first 6-bits of each byte into their un-encoded representation as 3 Bytes values in VOut1, VOut2, and VOut3.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.