Class TTextReader

Unit

Declaration

type TTextReader = class(TTextReaderWriter)

Description

Read any stream like a text file. You can read an arbitrary TStream instance, or you can read an URL. Reading from URL supports all URL protocols supportted by the Castle Game Engine engine (see https://castle-engine.io/manual_network.php ).

Includes comfortable Readln routine to read line by line (lines may be terminated in any OS convention). Includes comfortable Read to read next non-whitespace characters, ReadInteger to read next integer and such.

Do not use the underlying stream once you started reading it with this class. We will move the position within this stream ourselves.

Hierarchy

Overview

Methods

Public constructor Create(const URL: string); overload;
Public function Readln: string;
Public function Read: string;
Public function ReadInteger: Integer;
Public function ReadSingle: Single;
Public function ReadVector3: TVector3;
Public function ReadVector3Single: TVector3; deprecated 'use ReadVector3';
Public function Eof: boolean;

Description

Methods

Public constructor Create(const URL: string); overload;

Download and open a file.

Public function Readln: string;

Read next line from Stream. Returned string does not contain any end-of-line characters.

Public function Read: string;

Read the next string of non-whitespace characters. This skips any whitespace (including newlines) we currently see, then reads all non-whitespace characters as far as it can. It does not consume any whitespace characters after the string.

Returns empty string if and only if the stream ended. Otherwise, returns the read non-whitespace characters.

Public function ReadInteger: Integer;

Read the next Integer from stream. Reads next string of non-whitespace characters, like Read, and then converts it to Integer.

Exceptions raised
EConvertError
If the next non-whitespace string cannot be converted to Integer. This includes situations when stream ended (Read would return empty string in this case).
Public function ReadSingle: Single;

Read the next Single value from stream. Reads next string of non-whitespace characters, like Read, and then converts it to Single.

Exceptions raised
EConvertError
If the next non-whitespace string cannot be converted to Single. This includes situations when stream ended (Read would return empty string in this case).
Public function ReadVector3: TVector3;

Read the next vector from a stream, simply reading 3 Single values in sequence.

Exceptions raised
EConvertError
If one of the components cannot be converted to Single, or when stream ended prematurely.
Public function ReadVector3Single: TVector3; deprecated 'use ReadVector3';

Warning: this symbol is deprecated: use ReadVector3

 
Public function Eof: boolean;
 

Generated by PasDoc 0.16.0.