Topic Path: Symbol Reference > Classes > TIdDecoderBinHex4 Class > TIdDecoderBinHex4 Methods > Decode Method
ContentsIndexHome
PreviousUpNext
TIdDecoderBinHex4.Decode Method

Decodes BinHex 4.0-encoded data.

procedure Decode(
    const AIn: string; 
    const AStartPos: Integer = 1; 
    const ABytes: Integer = -1
); override;
Parameters 
Description 
AIn 
Encoded data for the operation.
 
AStartPos 
Starting position in the encoded data.
 
ABytes 
Number of bytes to be decoded. 

Decode is an overridden method in TIdDecoderBinHex4. Decode performs decoding for the BinHex data in AIn starting at the position indicated in AStartPos and continuing for the number of bytes indicated in ABytes. 

The value in AStartPos starts at 1 (one). 

ABytes can contain any value from 1 to the length of the input data in AIn. -1 indicates that all values in AIn will be decoded. 

Decode examines the values in AIn to determine when the Colon delimiter (ASCII decimal 58) is encountered at the start or end of the BinHex 4.0-encoded data. Decode raises the EIdMissingColon exception when the Colon delimiter characters are not found in the BinHex-encoded data. 

After values in AIn have been decoded, Decode checks for run-length encoding in the decoded content by looking for the RLE marker (ASCII Decimal 144 Hex 90). Run-length encoded values are restored to their non-RLE-encoded values. 

Decode removes the BinHex header included at the beginning of the content, including the following data types: 

 

Data Type 
Description 
Byte 
Length of the FileName (1..63) 
Bytes 
FileName bytes (up to "Length" bytes) 
Byte 
Long 
Type 
Long 
Creator 
Word 
Flags (And $F800) 
Long 
Length of Data Fork 
Long 
Length of Resource Fork 
Word 
CRC 
Bytes 
Data Fork ("Data Length" bytes) 
Word 
CRC 
Bytes 
Resource Fork ("Rsrc Length" bytes) 
Word 
CRC 

 

Decode writes the decoded values for the specified content to the stream for the decoder. 

Use TIdEncoderBinHex4 to create the values used in the AIn argument.

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