Topic Path: Symbol Reference > Classes > TIdEncoderBinHex4 Class > TIdEncoderBinHex4 Methods > EncodeFile Method
ContentsIndexHome
PreviousUpNext
TIdEncoderBinHex4.EncodeFile Method
procedure EncodeFile(
    AFileName: string; 
    ASrcStream: TIdStream; 
    ADestStream: TIdStream
);
Parameters 
Description 
AFileName 
File name to include in the header for the encoded content.
 
ASrcStream 
Stream with the un-encoded values for the operation.
 
ADestStream 
Stream with the encoded values from the operation. 

EncodeFile is an overloaded method used to create the BinHex 4.0-encoded format for data provided in ASrcStream. Encoded values are written to the stream indicated in ADestStream. 

AFilename indicates the file name to used in the BinHex 4.0 header, and should not exceed 255 bytes (the maximumn allowed in the encoding format). When AFilename exceeds 255 characters, extra character are truncated. 

EncodeFile does not implement optional run-length encoding for the BinHex format. 

EncodeFile writes the BinHex identification string in GBinHex4IdentificationString and the BinHex Header that includes 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 
Content CRC 
Bytes 
Data Fork ("Data Length" bytes) 
Word 
Data Fork CRC 
Bytes 
Resource Fork ("Rsrc Length" bytes) 
Word 
Resource Fork CRC 

 

The encoded content is written following the BinHex header information, with the Colon delimiter (ASCII Decimal 58) at both the beginning and end of the encoded data. 

Use the TIdDecoderBinHex4.Decode method to decode values created using EncodeFile.

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