System.Classes.TStream.WriteBuffer

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure WriteBuffer(const Buffer; Count: NativeInt); overload;
procedure WriteBuffer(const Buffer: TBytes; Count: NativeInt); overload;
procedure WriteBuffer(const Buffer: TBytes; Offset, Count: NativeInt); overload;

C++

void __fastcall WriteBuffer(const void *Buffer, NativeInt Count)/* overload */;
void __fastcall WriteBuffer(const System::DynamicArray<System::Byte> Buffer, NativeInt Count)/* overload */;
void __fastcall WriteBuffer(const 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

Writes Count bytes from Buffer onto the stream.

WriteBuffer attempts to write Count bytes from the Buffer to the current position in the stream, then WriteBuffer advances the current position by Count. If the stream fails to write all the requested bytes, an EWriteError exception is raised.

Offset specifies a zero-based position in Buffer of the first byte to write.

Use WriteBuffer to save data to a stream. WriteBuffer is used in cases, where the number of bytes to write is known and required, for example when writing in structures. Use WriteBuffer for standard file I/O streaming.

WriteBuffer is used internally for writing to a stream. It is used by other objects, such as strings and lists, for writing strings stored in a buffer.

WriteBuffer calls Write to handle the actual writing.

See Also