Internet Direct (Indy)
Home
PreviousUpNext
TIdBuffer.ExtractToStream Method

Writes extracted buffer data to a stream.

Pascal
procedure ExtractToStream(
    const AStream: TIdStream; 
    AByteCount: Integer = -1; 
    const AIndex: Integer = -1
);
Parameters 
Description 
AStream 
Destination for values extracted from the buffer.
 
AByteCount 
Number of bytes requested from the buffer.
 
AIndex 
Postion in the buffer where bytes for the output stream are stored. 

ExtractToStream is a procedure used to extract data from the buffer into the AStream argument. 

AStream is a TIdStream instance used to store values extracted from the current buffer. 

AByteCount indicates the number of bytes requested from the internal storage for the buffer. When AByteCount contains -1 the Size for the buffer is used when extracting data. 

AIndex is the zero-based offset of the byte value to extract from the internal storage for the buffer. AIndex normally contains a value in the range 0 (zero) to Size-1. When AIndex contains 0 or a positive value, the content in the buffer is not altered by the Extract operation. 

Using a negative value in AIndex indicates that data is being accessed sequentially. This causes space at the beginning of the buffer that has already been processed to be removed from the allocated internal storage for the buffer. It also causes Remove to be called to adjust the current buffer position and the space allocated for the buffer by the size for the ordinal data type. 

ExtractToStream checks the Size of Bytes to ensure that the requested number of bytes in AByteCount are available in the buffer. When the data is available, ExtractToStream will call the Write method in the TIdStream instance to perform the copy operation. 

Use one of the other Extract methods to read a specific data type from the internal storage for the buffer: 

 

Method 
Storage Data Type 
String 
Byte 
Cardinal 
Int64 
ExtractToStream 
Word 
Exceptions 
Description 
Raised with RSNotEnoughDataInBuffer and the requested byte count. 
Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.