Class TTextReader

Unit

Declaration

type TTextReader = class(TObject)

Description

TTextReader reads given Stream line by line. Lines may be terminated in Stream with #13, #10, #13+#10 or #10+#13. This way I can treat any TStream quite like standard Pascal text files: I have simple Readln method.

After calling Readln or Eof you should STOP directly using underlying Stream (but you CAN use Stream right after creating TTextReader.Create(Stream) and before any Readln or Eof operations on this TTextReader).

Original version of this class comes from Michalis Kamburelis code library, see [http://www.camelot.homedns.org/˜michalis/], unit base/KambiClassUtils.pas.

Hierarchy

Overview

Methods

Public constructor CreateFromFileStream(const FileName: string);
Public constructor Create(AStream: TStream; AOwnsStream: boolean);
Public destructor Destroy; override;
Public function Readln: string;
Public function Eof: boolean;

Description

Methods

Public constructor CreateFromFileStream(const FileName: string);

This is a comfortable constructor, equivalent to TTextReader.Create(TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite), true)

Public constructor Create(AStream: TStream; AOwnsStream: boolean);

If AOwnsStream then in Destroy we will free Stream object.

Public destructor Destroy; override;
 
Public function Readln: string;

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

Public function Eof: boolean;
 

Generated by PasDoc 0.16.0.