Share via


PTextReader.Read Method

Definition

Overloads

Read()

Reads the next character from the input stream and advances the character position by one character.

Read(Char[], Int32, Int32)

Reads a maximum of count characters from the current stream and writes the data to buffer, beginning at index.

Read()

Reads the next character from the input stream and advances the character position by one character.

public:
 override int Read();
public override int Read ();
override this.Read : unit -> int
Public Overrides Function Read () As Integer

Returns

The next character from the input stream, or -1 if no more characters are available. The default implementation returns -1.

Exceptions

An I/O error occurs.

Applies to

Read(Char[], Int32, Int32)

Reads a maximum of count characters from the current stream and writes the data to buffer, beginning at index.

public:
 override int Read(cli::array <char> ^ buffer, int index, int count);
public override int Read (char[] buffer, int index, int count);
override this.Read : char[] * int * int -> int
Public Overrides Function Read (buffer As Char(), index As Integer, count As Integer) As Integer

Parameters

buffer
Char[]

When this method returns, contains the specified character array with the values between index and (index + count - 1) replaced by the characters read from the current source.

index
Int32

The place in buffer at which to begin writing.

count
Int32

The maximum number of characters to read. If the end of the stream is reached before count of characters is read into buffer, the current method returns.

Returns

The number of characters that have been read. The number will be less than or equal to count, depending on whether the data is available within the stream. This method returns zero if called when no more characters are left to read.

Exceptions

An I/O error occurs.

index or count is negative.

The buffer length minus index is less than count.

buffer is null.

Applies to