Class ATextInputStream

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type ATextInputStream = class(AStreamWrapper)

Description

This class serves as the basis for a class which wraps around other instances of AStream and provides the ability to treat the data read from the stream as text. In particular, this class supports reading from ASCII- or UTF-8-encoded streams, as well as providing methods for reading and returning an entire line of text.

Hierarchy

Overview

Methods

Public function read(const count: TStreamIOSize; var dest): TStreamIOSize; override;
Public function readCharacters(count: TStreamIOSize; var dest: AnsiString): TStreamIOSize; virtual;
Public function readLine(var dest: AnsiString; const lineTerminator: string = System.lineEnding): TStreamIOSize;

Description

Methods

Public function read(const count: TStreamIOSize; var dest): TStreamIOSize; override;

Read count bytes from the buffer and store the data in dest.

This method simply passes the read call through to AStreamWrapper.Target. It does not attempt to interpret the data read. To retrieve one or more characters, call ATextInputStream.readCharacters. To retrieve a line of text, call ATextInputStream.readLine.

Returns

The total number of bytes read from the stream. This value may be less than count if the end of the stream was encountered while reading.

Public function readCharacters(count: TStreamIOSize; var dest: AnsiString): TStreamIOSize; virtual;

Read count characters from the stream and store the data in dest.

dest is set to an empty string by this routine before it begins to read.

This method reads from the underlying target stream and stores the desired number of characters in dest. As it reads from the stream, the method attempts to determine whether or not the character is encoded using ASCII or UTF-8 and adjusts accordingly.

Returns

The total number of characters read from the stream. This value may be less than count if the end of the stream was encountered while reading.

Public function readLine(var dest: AnsiString; const lineTerminator: string = System.lineEnding): TStreamIOSize;

Read characters from the stream until the end of a line (or the end of the stream itself) is encountered.

dest is set to an empty string by this routine before it begins to read.

This method reads from the underlying target stream and stores characters in dest until lineTerminator is reached. The line terminator characters will not be added to dest, but the next call to ATextInputStream.readLine will begin at the start of the next line in the underlying stream, unless the end of the stream is reached first.

Returns

The total number of characters read from the stream.


Generated by PasDoc 0.13.0 on 2015-06-23 19:40:11