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

TCustomMemoryStream

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

Abstract stream that stores its data in memory.

Declaration

Source position: classesh.inc line 669

type TCustomMemoryStream = class(TStream)

public

  function GetSize; override;

  

return the size of the stream.

  function Read(); override;

  

Reads Countbytes from the stream into buffer.

  function Seek(); override;

  

Sets a new position in the stream.

  procedure SaveToStream();

  

Writes the contents of the memory stream to another stream.

  procedure SaveToFile();

  

Writes the contents of the stream to a file.

  property Memory: Pointer; [r]

  

Pointer to the data kept in the memory stream.

end;

Inheritance

TCustomMemoryStream

  

Abstract stream that stores its data in memory.

|

TStream

  

Base class for streams.

|

TObject

Description

TCustomMemoryStreamis the parent class for streams that stored their data in memory. It introduces all needed functions to handle reading from and navigating through the memory, and introduces a Memoryproperty which points to the memory area where the stream data is kept.

The only thing which TCustomMemoryStreamdoes not do is obtain memory to store data when writing data or the writing of data. This functionality is implemented in descendent streams such as TMemoryStream. The reason for this approach is that this way it is possible to create e.g. read-only descendents of TCustomMemoryStreamthat point to a fixed part in memory which can be read from, but not written to.

Remark: Since TCustomMemoryStreamis an abstract class, do not create instances of TMemoryStreamdirectly. Instead, create instances of descendents such as TMemoryStream.

See also

TMemoryStream

  

Standard implementation of a stream that stores its data in memory

TStream

  

Base class for streams.