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

TMemoryStream

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

Standard implementation of a stream that stores its data in memory

Declaration

Source position: classesh.inc line 1058

type TMemoryStream = class(TCustomMemoryStream)

public

  destructor Destroy; override;

  

Frees any allocated memory and destroys the memory stream.

  procedure Clear;

  

Zeroes the position, capacity and size of the stream.

  procedure LoadFromStream();

  

Loads the contents of a stream into memory.

  procedure LoadFromFile();

  

Loads the contents of a file into memory.

  procedure SetSize(); override;

  

Sets the size for the memory stream.

  function Write(); override;

  

Writes data to the stream's memory.

end;

Inheritance

TMemoryStream

  

Standard implementation of a stream that stores its data in memory

|

TCustomMemoryStream

  

Abstract stream that stores its data in memory.

|

TStream

  

Base class for streams.

|

TObject

  

Base class of all classes.

Description

TMemoryStream is a TStream descendant that stores it's data in memory. It descends directly from TCustomMemoryStream and implements the necessary to allocate and de-allocate memory directly from the heap. It implements the Write method which is missing in TCustomMemoryStream.

TMemoryStream also introduces methods to load the contents of another stream or a file into the memory stream.

It is not necessary to do any memory management manually, as the stream will allocate or de-allocate memory as needed. When the stream is freed, all allocated memory will be freed as well.

See also

TCustomMemoryStream

  

Abstract stream that stores its data in memory.

TStream

  

Base class for streams.


Documentation generated on: May 14 2021