[Overview][Constants][Types][Classes][Procedures and functions][Variables] | Reference for unit 'Classes' (#fcl)

# TStream.Read

Reads data from the stream to a buffer and returns the number of bytes read.

## Declaration

`public function TStream.Read(`
`var Buffer;`
`Count: LongInt`
`):LongInt; virtual; abstract;`

## Description

Read attempts to read Count from the stream to Buffer and returns the number of bytes actually read.

This method should be used when the number of bytes is not determined. If a specific number of bytes is expected, use TSTream.ReadBuffer instead.

Read is an abstract method that is overridden by descendent classes to do the actual reading.

## Errors

Descendent classes that do not allow reading from the stream may raise an exception when the Read is used.

## See also

TStream.Write |  | Writes data from the stream to the buffer and returns the number of bytes written.
TStream.ReadBuffer |  | Reads data from the stream to a buffer