Class TBufferedReadStream
Unit
Declaration
type TBufferedReadStream = class(TPeekCharStream)
Description
Read another stream, sequentially, always being able to back one character, and buffering it. This implements abstract TPeekCharStream class, so this is a purely sequential read-only stream that reads from underlying SourceStream and you can use PeekChar and ReadChar and ReadUpto routines.
This stream will buffer incoming data from SourceStream. This means that reading by a very small chunks (like e.g. byte-by-byte) does not hurt performance.
Source: base/castleclassutils.pas (line 385).
Hierarchy
- TObject
- TStream
- TPeekCharStream
- TBufferedReadStream
Overview
Methods
| Protected | function GetSize: Int64; override; |
| Protected | procedure SetSize(NewSize: Longint); override; |
| Protected | procedure UpdateLineColumn(const C: AnsiChar); overload; |
| Protected | procedure UpdateLineColumn(const Buffer; const BufferCount: Integer); overload; |
| Public | constructor Create(ASourceStream: TStream; AOwnsSourceStream: boolean); |
| Public | destructor Destroy; override; |
| Public | function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; override; |
| Public | function Write(const Buffer; Count: Longint): Longint; override; |
| Public | function PeekChar: Integer; virtual; abstract; |
| Public | function ReadChar: Integer; virtual; abstract; |
| Public | function ReadUpto(const EndingChars: TSetOfChars): AnsiString; virtual; |
| Protected | function GetPosition: Int64; override; |
| Public | constructor Create(ASourceStream: TStream; AOwnsSourceStream: boolean; ABufferSize: Cardinal = DefaultReadBufferSize); |
| Public | destructor Destroy; override; |
| Public | function Read(var LocalBuffer; Count: Longint): Longint; override; |
| Public | function PeekChar: Integer; override; |
| Public | function ReadChar: Integer; override; |
| Public | function ReadUpto(const EndingChars: TSetOfChars): AnsiString; override; |
Properties
| Public | property SourceStream: TStream read FSourceStream; |
| Public | property OwnsSourceStream: boolean
read FOwnsSourceStream write FOwnsSourceStream; |
| Public | property Line: Int64 read FLine; |
| Public | property Column: Int64 read FColumn; |
| Public | property BufferSize: Cardinal read FBufferSize; |
Description
Methods
| Protected | function GetSize: Int64; override; |
|
. ReturnsSourceStream.Size | |
| Protected | procedure SetSize(NewSize: Longint); override; |
|
This stream doesn't support setting size. (All other versions of Exceptions raised
| |
| Protected | procedure UpdateLineColumn(const C: AnsiChar); overload; |
|
This item has no description. | |
| Protected | procedure UpdateLineColumn(const Buffer; const BufferCount: Integer); overload; |
|
This item has no description. | |
| Public | constructor Create(ASourceStream: TStream; AOwnsSourceStream: boolean); |
|
This item has no description. | |
| Public | destructor Destroy; override; |
|
This item has no description. | |
| Public | function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; override; |
|
This stream doesn't support seeking. (SetPosition and all other versions of Seek also call this.) Exceptions raised
| |
| Public | function Write(const Buffer; Count: Longint): Longint; override; |
|
This stream doesn't support writing. (WriteBuffer also calls this.) Exceptions raised
| |
| Public | function PeekChar: Integer; virtual; abstract; |
|
Peek next character. Returns the next character without making it "already read", so the next call to Read or ReadBuffer will return this char. Subsequent calls to Returns -1 if stream ended, otherwise returns Ord or given char. This may call SourceStream.Read, and any exceptions that may be raised in SourceStream.Read are propagated higher from this method. | |
| Public | function ReadChar: Integer; virtual; abstract; |
|
Read next character. A shortcut for Read(c, 1), but it returns -1 if end of stream is reached. So it's consistent with PeekChar. Sometimes it's also more comfortable, and it's a little faster. | |
| Public | function ReadUpto(const EndingChars: TSetOfChars): AnsiString; virtual; |
|
Read characters, until one of EndingChars (or end of stream) is found. The ending character is not "consumed" from the stream. The Result is guaranteed to not contain any char from EndingChars. | |
| Protected | function GetPosition: Int64; override; |
|
This item has no description. | |
| Public | constructor Create(ASourceStream: TStream; AOwnsSourceStream: boolean; ABufferSize: Cardinal = DefaultReadBufferSize); |
|
This item has no description. | |
| Public | destructor Destroy; override; |
|
This item has no description. | |
| Public | function Read(var LocalBuffer; Count: Longint): Longint; override; |
|
This item has no description. | |
| Public | function PeekChar: Integer; override; |
|
This item has no description. Showing description inherited from TPeekCharStream.PeekChar.
Peek next character. Returns the next character without making it "already read", so the next call to Read or ReadBuffer will return this char. Subsequent calls to Returns -1 if stream ended, otherwise returns Ord or given char. This may call SourceStream.Read, and any exceptions that may be raised in SourceStream.Read are propagated higher from this method. | |
| Public | function ReadChar: Integer; override; |
|
This item has no description. Showing description inherited from TPeekCharStream.ReadChar. Read next character. A shortcut for Read(c, 1), but it returns -1 if end of stream is reached. So it's consistent with PeekChar. Sometimes it's also more comfortable, and it's a little faster. | |
| Public | function ReadUpto(const EndingChars: TSetOfChars): AnsiString; override; |
|
This item has no description. Showing description inherited from TPeekCharStream.ReadUpto. Read characters, until one of EndingChars (or end of stream) is found. The ending character is not "consumed" from the stream. The Result is guaranteed to not contain any char from EndingChars. | |
Properties
| Public | property SourceStream: TStream read FSourceStream; |
|
Underlying stream. | |
| Public | property OwnsSourceStream: boolean
read FOwnsSourceStream write FOwnsSourceStream; |
|
Should we free underlying SourceStream at destruction. | |
| Public | property Line: Int64 read FLine; |
|
Line number in the file (counting from 1). | |
| Public | property Column: Int64 read FColumn; |
|
Column number in the file (counting from 1). | |
| Public | property BufferSize: Cardinal read FBufferSize; |
|
This item has no description. | |
Generated by PasDoc 0.17.0.snapshot.