Sign in Join
FPDoc Onlineexperiment

TCustomMemoryStream class

In unit Classes

Abstract stream that stores its data in memory.

Declaration

pascal
TCustomMemoryStream = class(TStream)

Inheritance

  1. TCustomMemoryStream
  2. TStream
  3. TObject

Descends from it: TLazarusResourceStream TMemoryStream TResourceStream

Description

TCustomMemoryStream is 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 Memory property which points to the memory area where the stream data is kept.

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

Since TCustomMemoryStream is an abstract class, do not create instances of TMemoryStream directly. Instead, create instances of descendants such as TMemoryStream.

See also

Properties

MemorypublicPointer to the data kept in the memory stream.
SizeBoundsSeekpublic

Methods

GetSizeprotectedreturn the size of the stream.
GetPositionprotected
SetPointerprotectedSets the internal memory pointer and size of the memory block.
ReadpublicReads Count bytes from the stream into buffer.
SeekpublicSets a new position in the stream.
SaveToStreampublicWrites the contents of the memory stream to another stream.
SaveToFilepublicWrites the contents of the stream to a file.

Inherited

From TObject (42)

AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance Create DefaultHandler DefaultHandlerStr Destroy Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName

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