[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Objects' (#rtl)

# TMemoryStream

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Stream which keeps data in memory.

## Declaration

Source position: objects.pp line 375

`type TMemoryStream = object(TStream)`
`BlkCount: LongInt;` |  | Number of allocated memory blocks
`BlkSize: Word;` |  | Size of one memory block
`MemSize: LongInt;` |  | Total memory size
`BlkList: PPointerArray;` |  | Pointer to list of allocated blocks.
`constructor Init();` |  | Initialize memory stream, reserves memory for stream data.
`destructor Done; virtual;` |  | Clean up memory and destroy the object instance.
`procedure Truncate; virtual;` |  | Set the stream size to the current position.
`procedure Read(); virtual;` |  | Read data from the stream to a location in memory.
`procedure Write(); virtual;` |  | Write data to the stream.
`end;`

## Inheritance

`TMemoryStream` |  | Stream which keeps data in memory.
`TStream` |  | Base stream class
`TObject` |  | Basis of all objects

## Description

The TMemoryStream object implements a stream that stores it's data in memory. The data is stored on the heap, with the possibility to specify the maximum amount of data, and the size of the memory blocks being used.

## See also

TStream |  | Base stream class