System.Classes.TMemoryStream.Write

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Write(const Buffer; Count: Longint): Longint; override;
function Write(const Buffer: TBytes; Offset, Count: Longint): Longint; override;

C++

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

Properties

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

Description

Writes Count bytes from Buffer to the current position in the memory buffer and updates the current position by Count bytes.

Use Write to insert Count bytes into the memory buffer of the memory stream, starting at the current position. Write will increase the size of the memory buffer, if necessary, to accommodate the data being written in. If the current position is not the end of the memory buffer, Write will overwrite the data following the current position.

Write updates the Size property to Position + Count, and sets the Position property to the new value of Size. Thus, any data that was stored in the memory stream in the Count bytes after the current position is lost when calling Write.

Write always writes the Count bytes in the Buffer, unless there is a memory failure. Thus, for TMemoryStream, Write is equivalent to the WriteBuffer method.

All other data-writing methods of a memory stream (WriteBuffer, WriteComponent) call Write to do the actual writing.

See Also