Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

Read method

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.




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.