From RAD Studio API Documentation
Jump to: navigation, search


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


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


Type Visibility Source Unit Parent
function public
System.Classes TCustomMemoryStream


Reads up to Count bytes from the memory stream into Buffer and advances the current position of the stream by the number of bytes read.

Use Read to read the contents of the memory stream into a buffer, starting at the current position. Read will read up to Count bytes from the current position in Memory. If Count bytes extends beyond the end of the memory buffer, Read will only transfer the data up to the end of the associated memory buffer. Read returns the number of bytes actually transferred to Buffer, and advances the current position accordingly. If the return value is less than Count, it means that reading reached the end of the stream data.

All the other data-reading methods of the memory stream (ReadBuffer, ReadComponent) call Read to do the actual reading.

Note: Read treats Count as an upper bound. The ReadBuffer method, by contrast, raises an exception if Count bytes cannot be read.

See Also