Sign in Join
FPDoc Onlineexperiment

TMemoryStream class

In unit Classes

Standard implementation of a stream that stores its data in memory.

Declaration

pascal
TMemoryStream = class(TCustomMemoryStream)

Inheritance

  1. TMemoryStream
  2. TCustomMemoryStream
  3. TStream
  4. TObject

Descends from it: TBytesStream

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

Properties

CapacityprotectedCurrent capacity of the stream.

Methods

ReallocprotectedSets the new capacity for the memory stream.
DestroypublicFrees any allocated memory and destroys the memory stream.
ClearpublicZeroes the position, capacity and size of the stream.
LoadFromStreampublicLoads the contents of a stream into memory.
LoadFromFilepublicLoads the contents of a file into memory.
SetSizepublicSets the size for the memory stream.
WritepublicWrites data to the stream's memory.

Inherited

From TCustomMemoryStream (9)

GetPosition GetSize Memory Read SaveToFile SaveToStream Seek SetPointer SizeBoundsSeek

From TObject (41)

AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance Create DefaultHandler DefaultHandlerStr 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.