Sign in Join
FPDoc Onlineexperiment

TMemoryStream.Init constructor

Member of TMemoryStreamIn unit Objects

Initialize memory stream, reserves memory for stream data.

Declaration

pascal
constructor Init(ALimit: LongInt; ABlockSize: Word)

Description

Init instantiates a new TMemoryStream object. The memorystreamobject will initially allocate at least ALimit bytes memory, divided into memory blocks of size ABlockSize. The number of blocks needed to get to ALimit bytes is rounded up.

By default, the number of blocks is 1, and the size of a block is 8192. This is selected if you specify 0 as the blocksize.

For an example, see e.g CopyFrom.

Errors

If the stream cannot allocate the initial memory needed for the memory blocks, then the stream's status is set to stInitError.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.