Indy 9
TIdIOHandlerStream
Hierarchy, Properties, Methods, Events, See Also, Unit: IdIOHandlerStream
Implements an input and output handler that uses a stream.
TIdIOHandlerStream = class(TIdIOHandler)
Unit
IdIOHandlerStream
Description
TIdIOHandlerStream is a TIdIOHandler descendant that implements the framework used to perform input and output operations for Indy components using a TStream as the source or destination.

TIdIOHandlerStream implements abstract virtual methods inherited from TIdIOHandler that allow the handler to determine when the handler is ready to perform an IO operation, and perform the data transmission or receipt required for a component.

TIdIOHandlerStream also exposes the ReadStream and WriteStream properties that allow acccess to the methods and properties of TStream instance used for input and output operations.


TIdIOHandlerStream.ReadStream
TIdIOHandlerStream, See Also
Represents the mechanism used for stream-based input.
property ReadStream: TStream;
Description
ReadStream is a TStream property that represents the underlying mechanism used to perform read operations in the input/output handler class. An Application must assign a valid TStream instance to the property to allow input operations using the handler.

TIdIOHandlerStream.StreamType
TIdIOHandlerStream
Indicates the input and/or output operations allowed for the stream-based IOHandler.
property StreamType: TIdIOHandlerStreamType;
Description
StreamType is a TIdIOHandlerStreamType property that indicates the input and/or output operations allowed for the stream-based IOHandler.

StreamType can be updated in the overloaded Create constructor.

The value of StreamType is used in the Connected method to indicate if ReadStream, WriteStream, or both are assigned and available for input and/or output operations.


TIdIOHandlerStream.WriteStream
TIdIOHandlerStream, See Also
Represents the mechanism used for stream-based input.
property WriteStream: TStream;
Description
WriteStream is a TStream property that represents the underlying mechanism used to perform Write operations in the input/output handler class. An Application must assign a valid TStream instance to the property to allow output operations using the handler.

TIdIOHandlerStream.Connected
TIdIOHandlerStream, See Also
Indicates that the input and output targets are valid for the handler.
function Connected: Boolean; override;
Return Value
Boolean - True when input and output streams have been assigned.
Description
Connected is an overriden Boolean function that indicates when both ReadStream and WriteStream contain valid TStream instances to be used for input and output using the handler. Applications must assign instances of a TStream descendant to ReadStream and WriteStream, or the method will return False.

TIdIOHandlerStream.Create
TIdIOHandlerStream, See Also
Constructor for the object instance.
constructor Create(AOwner: TComponent); override;
Parameters
AStreamType
Stream operation(s) allowed for the IOHandler.
axOwner
Component that owns the object instance.
Description
Create is the constructor for the object instance, and is overloaded in TIdIOHandlerStream.

The default constructor is intended for use when the object instance will be a child control owned by the component specified in axOwner, and simply calls the inherited Create method.

The overloaded constructor is intended for use when the TIdIOHandlerStream needs to be created for the specific read or write operations specified in AStreamType. This constructor calls the inherited Create method with Nil in the owner value. It also assigns the value in AStreamType to the StreamType property.


TIdIOHandlerStream.Destroy
TIdIOHandlerStream, See Also
Frees the object instance.
destructor Destroy; override;
Description
Destroy is the destructor for the object instance. Destroy calls the Close method, prior to calling the inherited destructor.

TIdIOHandlerStream.Readable
TIdIOHandlerStream, See Also
Indicates if the handler is ready to perform an input operation.
function Readable(AMSec: integer = IdTimeoutDefault): boolean; override;
Parameters
AMSec: integer = IdTimeoutDefault
Milliseconds to wait for a ready state. Default value is IdTimeoutDefault.
Return Value
Boolean - True when the handelr is ready to read or write.
Description
Readable is an overriden Boolean function that indicates if the handler is ready to perform an input operation. The return value for the method is True when ReadStream contains a valid TStream instance, and the current position is not at the end of the stream.

Note: The AMSec input parameter is not used for a strean-based input/output handler, and is provided for interface compatibility with the inherited method in the ancestor class.


TIdIOHandlerStream.Recv
TIdIOHandlerStream, See Also
Performs stream-based input operations for the handler.
function Recv(var ABuf; ALen: integer): integer; override;
Parameters
var ABuf
Buffer to receive values read from the stream.
ALen: integer
Number of bytes to read from the stream.
Return Value
Integer - Actual nmumber of bytes read from the stream.
Description
Recv is an overridden Integer function that implements read operations using the ReadStream for the input/output handler. If ReadStream does not a valid TSTream instance, the return value for the method is 0 (zero).

Recv uses the ReadStream object instance to load the number of bytes specified in ALen into the buffer specified in ABuf. The return value for the method is the actual number of bytes read from the stream.

Use Send to perform output operations using the handler.


TIdIOHandlerStream.Send
TIdIOHandlerStream, See Also
Performs stream-based output operations for the handler.
function Send(var ABuf; ALen: integer): integer; override;
Parameters
var ABuf
Buffer containg values to write to the stream.
ALen: integer
Number of bytes to write to the stream.
Return Value
Integer - Actual nmumber of bytes written to the stream.
Description
Send is an overridden Integer function that implements write operations using the WriteStream for the input/output handler. If WriteStream does not a valid TSTream instance, the return value for the method is 0 (zero).

Send uses the WriteStream object instance to write the number of bytes specified in ALen from the buffer specified in ABuf. The return value for the method is the actual number of bytes written to the stream.

Use Recv to perform input operations using the handler.


Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.