Declaration¶
Source position: objects.pp line 308
type
TStream = object(TObject)
Status: Integer;
ErrorInfo: Integer;
StreamSize: LongInt;
Position: LongInt;
TPCompatible: Boolean;
constructor Init;
function Get : PObject;
function StrRead : PAnsiChar;
function GetPos : LongInt;
function GetSize : LongInt;
function ReadStr : PString;
procedure Open;
procedure Close;
procedure Reset;
procedure Flush;
procedure Truncate;
procedure Put;
procedure StrWrite;
procedure WriteStr;
procedure Seek;
procedure Error;
procedure Read;
procedure Write;
procedure CopyFrom;
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.
Methods¶
| Member | Visibility | Description |
|---|---|---|
| Close | default | Close the stream. |
| CopyFrom | default | Copy data from another stream. |
| Error | default | Set stream status. |
| Flush | default | Flush the stream data from the buffer, if any. |
| Get | default | Read an object definition from the stream. |
| GetPos | default | Return current position in the stream. |
| GetSize | default | Return the size of the stream. |
| Init | default | Constructor for TStream instance. |
| Open | default | Open the stream. |
| Put | default | Write an object to the stream. |
| Read | default | Read data from stream to buffer. |
| ReadStr | default | Read a shortstring from the stream. |
| Reset | default | Reset the stream. |
| Seek | default | Set stream position. |
| StrRead | default | Read a null-terminated string from the stream. |
| StrWrite | default | Write a null-terminated string to the stream. |
| Truncate | default | Truncate the stream size on current position. |
| Write | default | Write a number of bytes to the stream. |
| WriteStr | default | Write a pascal string to the stream. |
Fieldss¶
| Member | Visibility | Description |
|---|---|---|
| ErrorInfo | default | Additional error info when there is an error. |
| Position | default | Current Stream position. |
| Status | default | Current stream status. |
| StreamSize | default | Current size of the stream. |
| TPCompatible | default | If set to True streamed data is written in a TP compatible format. |
See also¶
| Name | Description |
|---|---|
| PStream | Pointer type to TStream. |
| TDosStream | DOS file stream. |
| TMemoryStream | Stream which keeps data in memory. |