TIdMessageDecoder
Implements a decoder for RFC-822 compliant message parts.
Unit
Description
TIdMessageDecoder is a
TIdComponent descendant that implements a decoder for RFC-822 compliant message parts. TIdMessageDecoder provides properties and methods used to process RFC message header and body lines using a TStream descendant. TIdMessageDecoder is a base class that establishes the framework for Indy message decoders.
TIdMessageDecoder descendants, like TIdMessageDecoderMIME and TIdMessageDecoderUUE, further refine the message decoder framework by implementing support for encoding schemes.
Represents the file name for RFC-822 message attachments.
property Filename: string;
Description
Represents the RFC message headers in an RFC-822 compliant message part .
property Headers: TStrings;
Description
Headers is a read-only TStrings property that represents the RFC message headers in an RFC-822 compliant message part. Headers is used by
TIdMessageDecoder descendants to store the header values parsed from the RFC message part.
Headers will contain a TStrings representation of header names and values that orignate in RFC-822 form. For example, the following RFC-822 message header is stored in a Headers in the following form:
RFC-822 Message Header Content-Transfer-Encoding: base64
Header representation Content-Transfer-Encoding=base64
Use TStrings methods and properties to access Header values in TIdMessageDecoder.
Represents the type for an RFC message part.
Description
Providess access to a RFC-822 message as a stream construct.
property SourceStream: TStream;
Description
SourceStream is a TStream property in
TIdMessageDecoder that provide access to the contents of a RFC-822 message part. SourceStream is used by the
ReadLn method to retrieve a single line in the RFC-822 message.
Constructor for the object instance.
constructor Create(AOwner: TComponent); override;
Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance, and relies on the inherited Create method initialize properties to their default values. Create also instantiates a TStringList instance that represents the
Headers property.
Destructor for the object instance.
destructor Destroy; override;
Description
Destroy is the Destructor for the object instance. Destroy frees and releases resources allocated to the
Headers and
SourceStream properties prior to calling the inherited Destroy method.
Specifies the message decoder method used to extract an RFC-822 message body.
function ReadBody(ADestStream: TStream; var AMsgEnd: Boolean): TIdMessageDecoder; virtual; abstract;
Parameters
ADestStream: TStream
Stream where message body content will be stored.
Return Value
Description
ReadBody is an abstract virtual function in
TIdMessageDecoder that Specifies the method used to extract an RFC-822 message body in
TIdMessageDecoder descendants to the ADest stream.
TIdMessageDecoder descendants must re-implement the ReadBody method to provide support for the appropriate encoding algorithm and/or processing based on specific RFC message header values.
Specifies the method used to read an RFC message body.
procedure ReadHeader; virtual;
Description
ReadHeader is a virtual procedure in
TIdMessageDecoder that specifies the method used to read an RFC-822 compliant message body.
TIdMessageDecoder descendants, like
TIdMessageDecoderMIME and
TIdMessageDecoderUUE, must override ReadHeader to implement storage of parsed header names and values in message
Headers. ReadHeader must also update
PartType based on header values specific to the message decoder class. Additional properties in a descendant class may also require updates based on values detected in Header.
Reads a line from an RFC message part.
Return Value
String - Line read from the message part.
Description
ReadLn is a String function in
TIdMessageDecoder that a single line from an RFC-822 compliant message part. ReadLn uses
SourceStream, cast to a
TIdStream instance, as the origin of data for the
TIdStream.ReadLn method.
The return value for ReadLn can be an empty string ("") when the line from SourceStream consists of only a line termintaion character sequence, or the end of SourceStream has been reached.