/// <summary>
/// Read a single character.
/// </summary>
/// <returns>The character read.</returns>
public char Read()
{
if (cb.Length == 0)
{
// read from underlying reader
int readCount = reader.Read(buffer, 0, BlockSize);
if (readCount == 0)
{
throw new ApplicationException("End of stream.");
}
cb.SetBuffer(buffer, readCount);
}
char c = cb[0];
cb.Remove(0);
return(c);
}