System.Classes.TMemoryStream.SetSize

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure SetSize(const NewSize: Int64); override;
procedure SetSize(NewSize: Longint); override;

C++

virtual void __fastcall SetSize(const __int64 NewSize)/* overload */;
virtual void __fastcall SetSize(System::LongInt NewSize)/* overload */;

Properties

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

Description

Sets the Size property of the memory stream.

Use SetSize to set the Size of a memory stream before filling it with data. SetSize allocates the memory buffer to hold NewSize bytes, preserving as much of the existing data as possible.

Use SetSize before filling the memory buffer with data from various sources, or from a portion of another stream. If the intended contents of the memory stream is exactly the same as the contents of another stream or file, use LoadFromStream or LoadFromFile instead.

See Also