Project: Stream Extension Classes
Unit: PJStreamWrapper
Class: TPJStreamWrapper
Applies to: ~>3.0
constructor Create(const Stream: TStream; const CloseStream: Boolean = False); virtual;
This object constructor creates a new stream wrapper object that wraps a given stream.
Parameters:
- Stream -- Stream that is "wrapped" by this object.
- CloseStream -- Determines whether the wrapped stream object is freed when this wrapper object is destroyed. Pass
True
to this parameter to free the wrapped stream on destruction orFalse
to leave it unchanged.
Setting the CloseStream parameter to True
, hence causing the wrapper object to free the wrapped stream on destruction, saves the user from having to remember to free the wrapped stream. It also allows for wrapped streams that are created "on the fly" in this constructor call to be freed without keeping a reference to them.
The wrapped stream can be accessed from descendant classes via the BaseStream property.