Topic Path: Symbol Reference > Classes > TIdMessage Class > TIdMessage Methods > SaveToStream Method
TIdMessage.SaveToStream Method

Stores message headers and message parts to an output stream.

procedure SaveToStream(
    AStream: TIdStream; 
    const AHeadersOnly: Boolean = False
Destination used to write headers and message parts.
Indicates if only headers should be stored. Default value is False. 

SaveToStream is a procedure that allows storage of headers and optional message parts for the TIdMessage instance to the stream identified in AStream. 

AStream is a TIdStream descendant and represents the destination that will be used to write values in the message instance. AStream can be any TStream descendant suitable for use as the output stream in a TIdIOHandlerStream instance. 

AHeadersOnly indicates if only message headers should be written for the message instance. When AHeadersOnly is False, the entire message including all Headers and MessageParts will be stored in AStream. 

SaveToStream creates an instance of TIdMessageClient and TIdIOHandlerStream, and calls TIdMessageClient.SaveMsg to perform the physical output required to store values from the message instance. The TIdMessageClient instance and the IOIHandler are freed prior to exiting from the method. 

The current position in AStream is not changed before writing in the SaveToStream method. SaveToStream uses the current stream position to perform the physical output operation, and leaves the stream at the position following the write operation.

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