Internet Direct (Indy)
Home
PreviousUpNext
TIdIOHandler.ReadStream@TIdStream@LongInt@Boolean

Reads data from the IOHandler into a stream.

Parameters 
Description 
AStream 
Stream where data from the IOHandler will be stored.
 
AByteCount 
Number of bytes expected in the read request.
 
AReadUntilDisconnect 
Indicates data will be read until the IOHandler connection is closed. 

ReadStream is a procedure used to read data from the IOHandler and store the values in AStream. 

AByteCount indicates the number of bytes from the IOHandler to be read into AStream. When AByteCount contains -1 and AReadUntilDisconnect contains False, the byte count is read as an Integer value from the IOHandler. The size of AStream is adjusted to match the size expected from the IOHandler. 

ReadStream triggers the OnWork event handler to signal the read request. 

Any existing data in InputBuffer is extracted from the IOHandler into AStream first. Additional data must be read from the data source for the IOHandler and requires that Connected return True. When connected is False, the read request is considered to be complete. 

ReadStream calls ReadBytes to read byte values from the data source for the IOHandler. If an exception occurs while reading from the data source, the exception will be re-raised except under the following

 

  • AReadUntilDisconnect is True. When AReadUntilDisconnect contains true, is expected that the connection will close before all data in the read request has been processed. The exception is ignored.
 

ReadStream writes the byte values read from the IOHandler to the AStream argument. If the adjusted size of the stream is larger than the current stream position, data from the IOHandler data source was not available and the size of the steam is adjusted to match the current stream position. 

ReadStream triggers the OnWorkEnd event handler to signal completion of the read request.

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.