PeterO.Text.CharacterReader

PeterO.Text.CharacterReader

public sealed class CharacterReader :
    PeterO.Text.ICharacterInput

A general-purpose character input for reading text from byte streams and text strings. When reading byte streams, this class supports the UTF-8 character encoding by default, but can be configured to support UTF-16 and UTF-32 as well.

Member Summary

CharacterReader Constructor

public CharacterReader(
    string str);

Initializes a new instance of the PeterO.Text.CharacterReader class.

Parameters:

CharacterReader Constructor

public CharacterReader(
    string str,
    bool skipByteOrderMark);

Initializes a new instance of the PeterO.Text.CharacterReader class.

Parameters:

Exceptions:

CharacterReader Constructor

public CharacterReader(
    string str,
    bool skipByteOrderMark,
    bool errorThrow);

Initializes a new instance of the PeterO.Text.CharacterReader class.

Parameters:

Exceptions:

CharacterReader Constructor

public CharacterReader(
    string str,
    int offset,
    int length);

Initializes a new instance of the PeterO.Text.CharacterReader class.

Parameters:

Exceptions:

CharacterReader Constructor

public CharacterReader(
    string str,
    int offset,
    int length,
    bool skipByteOrderMark,
    bool errorThrow);

Initializes a new instance of the PeterO.Text.CharacterReader class.

Parameters:

Exceptions:

CharacterReader Constructor

public CharacterReader(
    System.IO.Stream stream);

Initializes a new instance of the PeterO.Text.CharacterReader class; will read the stream as UTF-8, skip the byte-order mark (U+FEFF) if it appears first in the stream, and replace invalid byte sequences with replacement characters (U+FFFD).

Parameters:

Exceptions:

CharacterReader Constructor

public CharacterReader(
    System.IO.Stream stream,
    int mode);

Initializes a new instance of the PeterO.Text.CharacterReader class; will skip the byte-order mark (U+FEFF) if it appears first in the stream and replace invalid byte sequences with replacement characters (U+FFFD).

Parameters:

.

Exceptions:

CharacterReader Constructor

public CharacterReader(
    System.IO.Stream stream,
    int mode,
    bool errorThrow);

Initializes a new instance of the PeterO.Text.CharacterReader class; will skip the byte-order mark (U+FEFF) if it appears first in the stream and a UTF-8 stream is detected.

Parameters:

.

CharacterReader Constructor

public CharacterReader(
    System.IO.Stream stream,
    int mode,
    bool errorThrow,
    bool dontSkipUtf8Bom);

Initializes a new instance of the PeterO.Text.CharacterReader class.

Parameters:

.

Exceptions:

Read

public sealed int Read(
    int[] chars,
    int index,
    int length);

Reads a series of code points from a Unicode stream or a string.

Parameters:

Return Value:

The number of code points read from the stream. This can be less than the length parameter if the end of the stream is reached.

Exceptions:

ReadChar

public sealed int ReadChar();

Reads the next character from a Unicode stream or a string.

Return Value:

The next character, or -1 if the end of the string or stream was reached.

Back to Encoding start page.