Sign in Join
FPDoc Onlineexperiment

TCachedDataStream class

In unit resdatastream

Base cached stream class

Declaration

pascal
TCachedDataStream = class(TStream)

Inheritance

  1. TCachedDataStream
  2. TStream
  3. TObject

Descends from it: TCachedResourceDataStream TGroupCachedDataStream

Description

This abstract class provides basic cached stream functionalities.

A cached stream is a read-only stream that operates on a portion of another stream. That is, it creates a "window" on the original stream from which to read data. Since it is a read-only stream, trying to write to the stream or to set its size cause an EInvalidOperation exception to be raised.

This class is used by TResourceDataStream to access the raw data of a resource. When an attempt to write to the stream is detected, TResourceDataStream replaces it with a memory stream and copies the contents of the cached stream to the memory one, thus providing a copy-on-write mechanism.

An object of this class should never be directly instantiated: use a descendant class instead.

See also

Methods

GetPositionprotected
SetPositionprotected
GetSizeprotectedReturn the size of the stream.
SetSize64protected
CreatepublicCreates a new object
WritepublicWrite a number of bytes to the stream.
SeekpublicSet stream position.

Fields

fStreamprotectedThe original stream
fSizeprotectedThe size of the cached stream
fPositionprotectedThe position from the cached stream perspective

Inherited

From TObject (41)

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