System.Classes.TStream.Read

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Read(var Buffer; Count: Longint): Longint; overload; virtual;
function Read(Buffer: TBytes; Offset, Count: Longint): Longint; overload; virtual;
function Read(var Buffer: TBytes; Count: Longint): Longint; overload;

C++

virtual int __fastcall Read(void *Buffer, int Count)/* overload */;
virtual int __fastcall Read(System::DynamicArray<System::Byte> Buffer, int Offset, int Count)/* overload */;
int __fastcall Read(System::DynamicArray<System::Byte> &Buffer, int Count)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.Classes.pas
System.Classes.hpp
System.Classes TStream

Description

Methods responsible for reading up to Count bytes of data from the stream into Buffer.

Descendant stream classes can define its own Read methods that read data from its particular storage medium (such as memory or a disk file) into a Buffer buffer.

Read is used in cases where the number of bytes to read from the stream is not necessarily fixed.

Read attempts to read, into Buffer, up to Count bytes from the stream, starting at the current position, and then advances the current position in the stream by the number of bytes actually transferred. Read returns the number of bytes actually read, which may be less than Count.

Offset specifies a zero-based position in Buffer from which to write the first byte into Buffer.

All the other data-reading methods of a stream (ReadBuffer, ReadData) call Read to do their actual reading.

See Also