TStream

[Properties (by Name)][Methods (by Name)][Events (by Name)]

Base stream class

Declaration

Source position: objects.pp line 306

Type
  TStream = object (TObject)
    Status : Integer;
    ErrorInfo : Integer;
    StreamSize : LongInt;
    Position : LongInt;
    TPCompatible : Boolean;
    constructor Init;
    function Get : PObject;
    function StrRead : PChar;
    function GetPos : LongInt;  Virtual;
    function GetSize : LongInt;  Virtual;
    function ReadStr : PString;
    procedure Open(OpenMode: Word);  Virtual;
    procedure Close;  Virtual;
    procedure Reset;
    procedure Flush;  Virtual;
    procedure Truncate;  Virtual;
    procedure Put(P: PObject);
    procedure StrWrite(P: PChar);
    procedure WriteStr(P: PString);
    procedure Seek(Pos: LongInt);  Virtual;
    procedure Error(Code: Integer; Info: Integer);  Virtual;
    procedure Read(var Buf; Count: LongInt);  Virtual;
    procedure Write(var Buf; Count: LongInt);  Virtual;
    procedure CopyFrom(var S: TStream; Count: LongInt);
  end
  ;

Description

The TStream object is the ancestor for all streaming objects, i.e. objects that have the capability to store and retrieve data.

It defines a number of methods that are common to all objects that implement streaming, many of them are virtual, and are only implemented in the descendent types.

Programs should not instantiate objects of type TStream directly, but instead instantiate a descendant type, such as TDosStream, TMemoryStream.

Members

Member Type Visibility Description
Close Method default Close the stream
CopyFrom Method default Copy data from another stream.
Error Method default Set stream status
ErrorInfo Field default Additional error info when there is an error.
Flush Method default Flush the stream data from the buffer, if any.
Get Method default Read an object definition from the stream.
GetPos Method default Return current position in the stream
GetSize Method default Return the size of the stream.
Init Method default Constructor for TStream instance
Open Method default Open the stream
Position Field default Current Stream position
Put Method default Write an object to the stream.
Read Method default Read data from stream to buffer.
ReadStr Method default Read a shortstring from the stream.
Reset Method default Reset the stream
Seek Method default Set stream position.
Status Field default Current stream status
StreamSize Field default Current size of the stream
StrRead Method default Read a null-terminated string from the stream.
StrWrite Method default Write a null-terminated string to the stream.
TPCompatible Field default If set to True streamed data is written in a TP compatible format.
Truncate Method default Truncate the stream size on current position.
Write Method default Write a number of bytes to the stream.
WriteStr Method default Write a pascal string to the stream.

Inheritance

Class Description
TStream Base stream class

See also

Name Description
Integer A signed 16-bits integer
Integer A signed 16-bits integer
LongInt A signed 32-bits integer
LongInt A signed 32-bits integer
PStream Pointer type to TStream
TDosStream DOS file stream
TMemoryStream Stream which keeps data in memory.