[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Base cached stream class
Source position: resdatastream.pp line 32
type TCachedDataStream = class(TStream) |
||
protected |
||
|
The original stream |
|
|
The size of the cached stream |
|
|
The position from the cached stream perspective |
|
function GetPosition; override; |
||
procedure SetPosition(); override; |
||
function GetSize; override; |
||
procedure SetSize64(); override; |
||
public |
||
constructor Create(); virtual; |
|
Creates a new object |
function Write(); override; |
||
function Seek(); override; |
||
end; |
|
Base cached stream class |
|
| | ||
| | ||
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.
Remark: | An object of this class should never be directly instantiated: use a descendant class instead. |
|
Stream class that provides copy-on-write functionality |
|
|
An implementation of a cached stream |