System.Classes.TStream.ReadBuffer
Delphi
procedure ReadBuffer(var Buffer; Count: NativeInt); overload;
procedure ReadBuffer(var Buffer: TBytes; Count: NativeInt); overload;
procedure ReadBuffer(var Buffer: TBytes; Offset, Count: NativeInt); overload;
C++
void __fastcall ReadBuffer(void *Buffer, NativeInt Count)/* overload */;
void __fastcall ReadBuffer(System::DynamicArray<System::Byte> &Buffer, NativeInt Count)/* overload */;
void __fastcall ReadBuffer(System::DynamicArray<System::Byte> &Buffer, NativeInt Offset, NativeInt Count)/* overload */;
Properties
| Type | Visibility | Source | Unit | Parent |
|---|---|---|---|---|
procedure function |
public | System.Classes.pas System.Classes.hpp |
System.Classes | TStream |
Description
Reads Count bytes from the stream into Buffer.
Use ReadBuffer to read Count bytes from the stream into a Buffer buffer in cases where the number of bytes to read is known and fixed, for example when reading in structures. ReadBuffer is used internally for loading from a stream and copying from a stream.
Read attempts to read exactly 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.
Offset specifies a zero-based position in Buffer from which to write the first byte into Buffer.
ReadBuffer calls Read to do the actual reading. If Count bytes cannot be read from the stream, an EReadError exception is raised.