Skip to content

THandleStream

Base class for streams that are identified by an OS handle.

Declaration

Source position: classesh.inc line 1581

type

  THandleStream = class(TStream)
  public
    constructor Create;
    function Read : LongInt;
    function Write : LongInt;
    function Seek : Int64;
    property Handle: THandle; {r}
  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.

Properties

Member Visibility Description
Handle read only public The OS handle of the stream.
See all Properties

Methods

Member Visibility Description
Create public Create a handlestream from an OS Handle.
Read public Overrides standard read method.
Seek public Overrides the Seek method.
Write public Overrides standard write method.
See all Methods

See also

Name Description
TStream Base class for streams.
TFileStream Stream that stores its data in a named file on disk.