Declaration¶
Source position: classesh.inc line 1344
type
TStream = class(TObject)
public
const
DefaultWriteUnitname : Boolean = False;
function Read(var Buffer; Count: LongInt) : LongInt; overload;
function Read(var Buffer: TBytes; Count: LongInt) : LongInt; overload;
function Read(Buffer: TBytes; aOffset: LongInt; Count: LongInt)
: LongInt; overload;
function Read64 : Int64; overload;
function Write(const Buffer: TBytes; Offset: LongInt; Count: LongInt)
: LongInt; overload;
function Write(const Buffer: TBytes; Count: LongInt) : LongInt; overload;
function Write(const Buffer; Count: LongInt) : LongInt; overload;
function Write64 : Int64;
function Seek(Offset: LongInt; Origin: Word) : LongInt; overload;
function Seek(const Offset: Int64; Origin: TSeekOrigin) : Int64; overload;
function ReadData(Buffer: Pointer; Count: NativeInt) : NativeInt; overload;
function ReadData(Buffer: TBytes; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: Boolean) : NativeInt; overload;
function ReadData(var Buffer: Boolean; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: AnsiChar) : NativeInt; overload;
function ReadData(var Buffer: AnsiChar; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: WideChar) : NativeInt; overload;
function ReadData(var Buffer: WideChar; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: Int8) : NativeInt; overload;
function ReadData(var Buffer: Int8; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: UInt8) : NativeInt; overload;
function ReadData(var Buffer: UInt8; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: Int16) : NativeInt; overload;
function ReadData(var Buffer: Int16; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: UInt16) : NativeInt; overload;
function ReadData(var Buffer: UInt16; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: Int32) : NativeInt; overload;
function ReadData(var Buffer: Int32; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: UInt32) : NativeInt; overload;
function ReadData(var Buffer: UInt32; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: Int64) : NativeInt; overload;
function ReadData(var Buffer: Int64; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: UInt64) : NativeInt; overload;
function ReadData(var Buffer: UInt64; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: Single) : NativeInt; overload;
function ReadData(var Buffer: Single; Count: NativeInt) : NativeInt; overload;
function ReadData(var Buffer: Double) : NativeInt; overload;
function ReadData(var Buffer: Double; Count: NativeInt) : NativeInt; overload;
procedure ReadBuffer(var Buffer; Count: NativeInt);
procedure ReadBuffer(var Buffer: TBytes; Count: NativeInt); overload;
procedure ReadBuffer(var Buffer: TBytes; Offset: NativeInt;
Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: Boolean); overload;
procedure ReadBufferData(var Buffer: Boolean; Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: AnsiChar); overload;
procedure ReadBufferData(var Buffer: AnsiChar; Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: WideChar); overload;
procedure ReadBufferData(var Buffer: WideChar; Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: Int8); overload;
procedure ReadBufferData(var Buffer: Int8; Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: UInt8); overload;
procedure ReadBufferData(var Buffer: UInt8; Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: Int16); overload;
procedure ReadBufferData(var Buffer: Int16; Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: UInt16); overload;
procedure ReadBufferData(var Buffer: UInt16; Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: Int32); overload;
procedure ReadBufferData(var Buffer: Int32; Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: UInt32); overload;
procedure ReadBufferData(var Buffer: UInt32; Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: Int64); overload;
procedure ReadBufferData(var Buffer: Int64; Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: UInt64); overload;
procedure ReadBufferData(var Buffer: UInt64; Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: Single); overload;
procedure ReadBufferData(var Buffer: Single; Count: NativeInt); overload;
procedure ReadBufferData(var Buffer: Double); overload;
procedure ReadBufferData(var Buffer: Double; Count: NativeInt); overload;
procedure WriteBuffer(const Buffer; Count: NativeInt);
procedure WriteBuffer(const Buffer: TBytes; Count: NativeInt); overload;
procedure WriteBuffer(const Buffer: TBytes; Offset: NativeInt;
Count: NativeInt); overload;
function WriteData(const Buffer: TBytes; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: Pointer; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: Boolean) : NativeInt; overload;
function WriteData(const Buffer: Boolean; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: AnsiChar) : NativeInt; overload;
function WriteData(const Buffer: AnsiChar; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: WideChar) : NativeInt; overload;
function WriteData(const Buffer: WideChar; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: Int8) : NativeInt; overload;
function WriteData(const Buffer: Int8; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: UInt8) : NativeInt; overload;
function WriteData(const Buffer: UInt8; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: Int16) : NativeInt; overload;
function WriteData(const Buffer: Int16; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: UInt16) : NativeInt; overload;
function WriteData(const Buffer: UInt16; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: Int32) : NativeInt; overload;
function WriteData(const Buffer: Int32; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: UInt32) : NativeInt; overload;
function WriteData(const Buffer: UInt32; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: Int64) : NativeInt; overload;
function WriteData(const Buffer: Int64; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: UInt64) : NativeInt; overload;
function WriteData(const Buffer: UInt64; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: Single) : NativeInt; overload;
function WriteData(const Buffer: Single; Count: NativeInt) : NativeInt; overload;
function WriteData(const Buffer: Double) : NativeInt; overload;
function WriteData(const Buffer: Double; Count: NativeInt) : NativeInt; overload;
procedure WriteBufferData(Buffer: Int32); overload;
procedure WriteBufferData(Buffer: Int32; Count: NativeInt); overload;
procedure WriteBufferData(Buffer: Boolean); overload;
procedure WriteBufferData(Buffer: Boolean; Count: NativeInt); overload;
procedure WriteBufferData(Buffer: AnsiChar); overload;
procedure WriteBufferData(Buffer: AnsiChar; Count: NativeInt); overload;
procedure WriteBufferData(Buffer: WideChar); overload;
procedure WriteBufferData(Buffer: WideChar; Count: NativeInt); overload;
procedure WriteBufferData(Buffer: Int8); overload;
procedure WriteBufferData(Buffer: Int8; Count: NativeInt); overload;
procedure WriteBufferData(Buffer: UInt8); overload;
procedure WriteBufferData(Buffer: UInt8; Count: NativeInt); overload;
procedure WriteBufferData(Buffer: Int16); overload;
procedure WriteBufferData(Buffer: Int16; Count: NativeInt); overload;
procedure WriteBufferData(Buffer: UInt16); overload;
procedure WriteBufferData(Buffer: UInt16; Count: NativeInt); overload;
procedure WriteBufferData(Buffer: UInt32); overload;
procedure WriteBufferData(Buffer: UInt32; Count: NativeInt); overload;
procedure WriteBufferData(Buffer: Int64); overload;
procedure WriteBufferData(Buffer: Int64; Count: NativeInt); overload;
procedure WriteBufferData(Buffer: UInt64); overload;
procedure WriteBufferData(Buffer: UInt64; Count: NativeInt); overload;
procedure WriteBufferData(Buffer: Single); overload;
procedure WriteBufferData(Buffer: Single; Count: NativeInt); overload;
procedure WriteBufferData(Buffer: Double); overload;
procedure WriteBufferData(Buffer: Double; Count: NativeInt); overload;
function CopyFrom : Int64;
function ReadComponent : TComponent;
function ReadComponentRes : TComponent;
procedure WriteComponent(Instance: TComponent); overload;
procedure WriteComponent(Instance: TComponent; aWriteUnitname: Boolean); overload;
procedure WriteComponentRes(const ResName: string; Instance: TComponent); overload;
procedure WriteComponentRes(const ResName: string;
Instance: TComponent;
aWriteUnitname: Boolean); overload;
procedure WriteDescendent(Instance: TComponent; Ancestor: TComponent); overload;
procedure WriteDescendent(Instance: TComponent; Ancestor: TComponent;
aWriteUnitname: Boolean); overload;
procedure WriteDescendentRes(const ResName: string;
Instance: TComponent; Ancestor: TComponent); overload;
procedure WriteDescendentRes(const ResName: string;
Instance: TComponent; Ancestor: TComponent;
aWriteUnitname: Boolean); overload;
procedure WriteResourceHeader;
procedure FixupResourceHeader;
procedure ReadResHeader;
function ReadByte : Byte;
function ReadWord : Word;
function ReadDWord : Cardinal;
function ReadQWord : QWord;
function ReadAnsiString : AnsiString;
function ReadUnicodeString : WideString;
procedure WriteByte;
procedure WriteWord;
procedure WriteDWord;
procedure WriteQWord;
procedure WriteAnsiString;
procedure WriteUnicodeString;
property Position: Int64; {rw}
property Size: Int64; {rw}
end;
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.
Descendant classes such as TMemoryStream or TFileStream then override these methods to write streams to memory or file.
Properties¶
| Member | Visibility | Description |
|---|---|---|
| Position | public | The current position in the stream. |
| Size | public | The current size of the stream. |
Methods¶
| Member | Visibility | Description |
|---|---|---|
| CopyFrom | public | Copy data from one stream to another. |
| FixupResourceHeader | public | Not implemented in FPC. |
| Read | public | Reads data from the stream to a buffer and returns the number of bytes read. |
| Read64 | public | |
| ReadAnsiString | public | Read an ansistring from the stream and return its value. |
| ReadBuffer | public | Reads data from the stream to a buffer. |
| ReadBufferData | public | |
| ReadByte | public | Read a byte from the stream and return its value. |
| ReadComponent | public | Reads component data from a stream. |
| ReadComponentRes | public | Reads component data and resource header from a stream. |
| ReadData | public | |
| ReadDWord | public | Read a DWord from the stream and return its value. |
| ReadQWord | public | Read a QWord value from the stream and return its value. |
| ReadResHeader | public | Read a resource header from the stream. |
| ReadUnicodeString | public | |
| ReadWord | public | Read a word from the stream and return its value. |
| Seek | public | Sets the current position in the stream. |
| Write | public | Writes data from a buffer to the stream and returns the number of bytes written. |
| Write64 | public | |
| WriteAnsiString | public | Write an ansistring to the stream. |
| WriteBuffer | public | Writes data from a buffer to the stream. |
| WriteBufferData | public | |
| WriteByte | public | Write a byte to the stream. |
| WriteComponent | public | Write component data to the stream. |
| WriteComponentRes | public | Write resource header and component data to a stream. |
| WriteData | public | |
| WriteDescendent | public | Write descendent of a component. |
| WriteDescendentRes | public | Write descendent of a component as resource. |
| WriteDWord | public | Write a DWord to the stream. |
| WriteQWord | public | Write a QWord value to the stream. |
| WriteResourceHeader | public | Write resource header to the stream. |
| WriteUnicodeString | public | |
| WriteWord | public | Write a word to the stream. |
See also¶
| Name | Description |
|---|---|
| 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. |