Topic Path: Symbol Reference > Classes > TIdEncoder3to4 Class > TIdEncoder3to4 Methods > EncodeIdBytes Method
TIdEncoder3to4.EncodeIdBytes Method

Performs the encoding algorithm for the encoder using the data specified in an array of bytes.

function EncodeIdBytes(
    ABuffer: TIdBytes
): TIdBytes;
Byte array with values to encode

TIdBytes - Byte array with encoded values.

EncodeIdBytes is a TIdBytes function used to perform the encoding algorithm for the encoder using data specified in the ABuffer argument. 

EncodeIdBytes determines the number of bytes required for the 3-byte to 4-byte encoding and pre-allocates the size of the TIdBytes data type used for the return value to the required size. 

EncodeIdBytes copies the bytes from ABuffer in 3-byte chunks and converts each chunk to 4-byte return value using the CodingTable and the encoding algorithm. When there are not enough remaining bytes in ABuffer, the missing input bytes are given the value 0 (zero). Missing bytes are also indicated in the results for the method by adding the required number of the characters from the FillChar property. 

EncodeIdBytes will raise EAssertionFailed exceptions under the following circumstances: 


CodingTable has not been assigned for the encoder instance. 
The required length of the byte array in the result value is larger than the pre-allocated length. 
The pre-allocated length of the byte array in the result value is larger than the actual number of bytes required. 


EncodeIdBytes is used in the implementation of the Encode method.

Raised under conditions previously described. 
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.