public virtual int ReadChar()
{
// Reads one char from the stream by calling Read(char[], int, int).
// Will return an char cast to an int or -1 on end of stream.
// The performance of the default implementation on Stream is bad,
// and any subclass with an internal buffer should override this method.
char[] oneCharArray = new char[1];
int r = Read(oneCharArray, 0, 1);
if (r == 0)
return -1;
return oneCharArray[0];
}