Internet Direct (Indy)
Home
PreviousUpNext
TIdIOHandler.Write@TIdStream@Integer@Boolean

Write the specified values to the IOHandler.

Parameters 
Description 
AStream 
Source of values to write to the IOHandler.
 
ASize 
Number of bytes from the stream to write to the IOHandler.
 
AWriteByteCount 
Indicates the binary length is written at the start of the stream. 

Write is an overloaded method in TIdIOHandler used to write various data types from the indicated source to the IOHandler. Write can use the Indy write buffering mechanism when it has been enabled. 

ASize is used to determine the position and size of the stream using the following criteria: 

 

Value 
Meaning 
< 0 
The stream is read from the current position until the end of the stream. 
The stream is read using the stream size. The stream position is set to 0 prior to reading values for the IOHandler. 
> 0 
The current stream position is used, and the value in AWriteByteCount is written followed by values in the stream. 

 

Write triggers the OnWorkBegin event handler prior to writing any values to the IOHandler connection. 

Write calls WriteBytes to copy values from the stream in AStream to the IOHandler connection. When ASize is larger than the buffer size specified in SendBufferSize, WriteBytes will be called until ASize number of bytes have been written to the IOHandler connection. 

Write can raise an exception when AStream does not contain enough data to satisfy the number of bytes for the write request. 

Write triggers the OnWorkEnd event handler when the write request has been completed. 

Call WriteBufferOpen to enable write buffer for the IOHandler. 

Call WriteBufferClose to disable write buffer for the IOHandler.

Exceptions 
Description 
Raised with the RSIdNoDataToRead message when there is not enough data in the stream to satisfy the number of bytes for the write request. 

Write 

WriteBytes 

WriteBufferOpen 

WriteBufferClose OnWorkBegin 

OnWorkEnd 

Write 

EIdNoDataToRead 

RSIdNoDataToRead

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.