[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Objects' (#rtl)

# TStream

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

Base stream class

## Declaration

Source position: objects.pp line 271

`type TStream = object(TObject)`
`Status: Integer;` |  | Current stream status
`ErrorInfo: Integer;` |  | Additional error info when there is an error.
`StreamSize: LongInt;` |  | Current size of the stream
`Position: LongInt;` |  | Current Stream position
`TPCompatible: Boolean;` |  | If set to True streamed data is written in a TP compatible format.
`constructor Init;` |  | Constructor for TStream instance
`function Get;` |  | Read an object definition from the stream.
`function StrRead;` |  | Read a null-terminated string from the stream.
`function GetPos; virtual;` |  | Return current position in the stream
`function GetSize; virtual;` |  | Return the size of the stream.
`function ReadStr;` |  | Read a shortstring from the stream.
`procedure Open(); virtual;` |  | Open the stream
`procedure Close; virtual;` |  | Close the stream
`procedure Reset;` |  | Reset the stream
`procedure Flush; virtual;` |  | Flush the stream data from the buffer, if any.
`procedure Truncate; virtual;` |  | Truncate the stream size on current position.
`procedure Put();` |  | Write an object to the stream.
`procedure StrWrite();` |  | Write a null-terminated string to the stream.
`procedure WriteStr();` |  | Write a pascal string to the stream.
`procedure Seek(); virtual;` |  | Set stream position.
`procedure Error(); virtual;` |  | Set stream status
`procedure Read(); virtual;` |  | Read data from stream to buffer.
`procedure Write(); virtual;` |  | Write a number of bytes to the stream.
`procedure CopyFrom();` |  | Copy data from another stream.
`end;`

## Inheritance

`TStream` |  | Base stream class
`TObject` |  | Basis of all objects

## 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.

## See also

PStream |  | Pointer type to TStream
TDosStream |  | DOS file stream
TMemoryStream |  | Stream which keeps data in memory.

Documentation generated on: Feb 26 2014