Topic Path: Symbol Reference > Classes > TIdBuffer Class > TIdBuffer Methods > Write Method > Write Method (TIdStream, Integer)
ContentsIndexHome
PreviousUpNext
TIdBuffer.Write Method (TIdStream, Integer)

Adds data to the internal storage for the Indy buffer.

procedure Write(
    AStream: TIdStream; 
    AByteCount: Integer = 0
); overload;
Parameters 
Description 
AStream 
Source of values to be stored in the buffer.
 
AByteCount 
Number of bytes from the source to be added to the Indy buffer. Default value is 0. 

Write is an overloaded procedure used to append the specified values to the end of any existing data in the internal storage for the Indy buffer. 

AStream is the TIdStream containing values to be added to the buffer. 

AByteCount indicates the number of bytes from AStream to be added to the Indy buffer. 

When AByteCount contains -1, any data in AStream from the current stream position to the end of the stream will be added to the buffer. 

When AByteCount contains 0 (zero), all data in AStream will be added to the buffer. AStream is repositioned to its beginning prior to reading values in the stream. 

When AByteCount contains a positive non-zero value, byte values are copied from the stream using its current position. The number of bytes is adjusted so that it does not exceed the remaining number of bytes in AStream. 

Write checks the size of the internal storage for the buffer to ensure that writing the requested number of Bytes will not result in an internal storage area too large for the host platform or operating system. 

Write calls protected methods in the class to remove dead space at the beginning of the internal storage for the buffer, and reallocate the storage area to include the unused buffer induicated in GrowthFactor

Write uses the TIdStream.ReadBytes method to add the indicated number of bytes in AByteCount to the internal storage for the buffer. Size is updated to the reflect the number of bytes added to the buffer from AStream.

Exceptions 
Description 
With RSTooMuchDataInBuffer when the requested number of bytes will result in an internal storage area too large for the host platform or operating system. 
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.