Project: Stream Extension Classes
Unit: PJStreamWrapper
Class: TPJStreamWrapper
Applies to: ~>3.0
function Read(var Buffer; Count: Longint): Longint; override;
This method overrides and implements an abstract method of TStream.
Read attempts to read a specified number of bytes from the stream into a buffer.
Parameters:
- Buffer -- Untyped buffer that receives the data read from the wrapped stream. This variable passed to this parameter must have a size of at least Count bytes.
- Count -- The number of bytes to be read from the stream. If the stream does not contain sufficient data to fulfil the request just the available number of bytes are read.
Returns:
- Number of bytes actually read.
If the requested number of bytes are available in the wrapped stream then Buffer receives Count bytes and the method's return value is equal to Count. If there is insufficient data remaining in the wrapped stream to fulfil the request then any remaining bytes are read from the stream into Buffer and the return value will be less than Count. If the stream is at the end when the request is made then no data is copied into Buffer and zero is returned.
Note that the wrapped stream is read from the current position and the position is incremented by the number of bytes read.
An exception may be raised if the wrapped stream does not support read access.