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

# TStream

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

Base class for streams.

## Declaration

Source position: classesh.inc line 829

`type TStream = class(TObject)`
`public`
`function Read(); virtual;` |  | Reads data from the stream to a buffer and returns the number of bytes read.
`function Write(); virtual;` |  | Writes data from a buffer to the stream and returns the number of bytes written.
`function Seek();` |  | Sets the current position in the stream
`procedure ReadBuffer();` |  | Reads data from the stream to a buffer
`procedure WriteBuffer();` |  | Writes data from a buffer to the stream
`function CopyFrom();` |  | Copy data from one stream to another
`function ReadComponent();` |  | Reads component data from a stream
`function ReadComponentRes();` |  | Reads component data and resource header from a stream
`procedure WriteComponent();` |  | Write component data to the stream
`procedure WriteComponentRes();` |  | Write resource header and component data to a stream
`procedure WriteDescendent();` |  | Write component data to a stream, relative to an ancestor
`procedure WriteDescendentRes();` |  | Write resource header and component data to a stream, relative to an ancestor
`procedure WriteResourceHeader();` |  | Write resource header to the stream
`procedure FixupResourceHeader();` |  | Not implemented in FPC
`procedure ReadResHeader;` |  | Read a resource header from the stream.
`function ReadByte;` |  | Read a byte from the stream and return its value.
`function ReadWord;` |  | Read a word from the stream and return its value.
`function ReadDWord;` |  | Read a DWord from the stream and return its value.
`function ReadQWord;` |  | Read a QWord value from the stream and return its value
`function ReadAnsiString;` |  | Read an ansistring from the stream and return its value.
`procedure WriteByte();` |  | Write a byte to the stream.
`procedure WriteWord();` |  | Write a word to the stream.
`procedure WriteDWord();` |  | Write a DWord to the stream.
`procedure WriteQWord();` |  | Write a QWord value to the stream
`procedure WriteAnsiString();` |  | Write an ansistring to the stream.
`property Position: Int64; [rw]` |  | The current position in the stream.
`property Size: Int64; [rw]` |  | The current size of the stream.
`end;`

## Inheritance

`TStream` |  | Base class for streams.
`TObject` |  | Base class of all classes.

## Description

TStream is the base class for all streaming classes. It defines methods for reading, writing from and to streams, as well as functions to determine the size of the stream as well as the current position of the stream.

Descendent classes such as TMemoryStream or TFileStream then override these methods to write streams to memory or file.

## See also

TMemoryStream |  | Standard implementation of a stream that stores its data in memory
TFileStream |  | Stream that stores its data in a named file on disk.
TStringStream |  | Stream that stores its data in a string.

Documentation generated on: Feb 26 2014