THandleStream
[Properties (by Name)][Methods (by Name)][Events (by Name)]
Base class for streams that are identified by an OS handle.
Declaration
Source position: classesh.inc line 1165
Type
THandleStream = class (TStream)
private
FHandle : THandle;
protected
procedure SetSize(NewSize: LongInt); Override;
procedure SetSize(const NewSize: Int64); Override;
public
constructor Create(AHandle: THandle);
function Read(var Buffer; Count: LongInt) : LongInt; Override;
function Write(const Buffer; Count: LongInt) : LongInt; Override;
function Seek(const Offset: Int64; Origin: TSeekOrigin) : Int64
; Override;
Handle : THandle;
end
;
Description
THandleStream is an abstract descendant of the TStream class that provides methods for a stream to handle all reading and writing to and from a handle, provided by the underlying OS. To this end, it overrides the Read and Write methods of TStream.
Remark
ThandleStream does not obtain a handle from the OS by itself, it just handles reading and writing to such a handle by wrapping the system calls for reading and writing; Descendant classes should obtain a handle from the OS by themselves and pass it on in the inherited constructor. Contrary to Delphi, no seek is implemented for THandleStream, since pipes and sockets do not support this. The seek is implemented in descendant methods that support it. !!!
Members
Member | Type | Visibility | Description |
---|---|---|---|
Create | Method | public | Create a handlestream from an OS Handle. |
FHandle | Field | private | |
Handle | Property | public | The OS handle of the stream. |
Read | Method | public | Overrides standard read method. |
Seek | Method | public | Overrides the Seek method. |
SetSize | Method | protected | |
Write | Method | public | Overrides standard write method. |
Inheritance
Class | Description |
---|---|
THandleStream | Base class for streams that are identified by an OS handle. |
See also
Name | Description |
---|---|
TFileStream | Stream that stores its data in a named file on disk. |
THandle | Type to manage streams. |
THandle | Type to manage streams. |
TStream | Base class for streams. |