namespace System.IO {
class CStreamReader : StreamReader {
+ TermInfoDriver driver;
+
public CStreamReader(Stream stream, Encoding encoding)
: base (stream, encoding)
{
+ driver = (TermInfoDriver) ConsoleDriver.driver;
}
public override int Peek ()
return(-1);
}
- public override int Read ([In, Out] char [] dest_buffer, int index, int count)
+ public override int Read ([In, Out] char [] dest, int index, int count)
{
- if (dest_buffer == null)
- throw new ArgumentNullException ("dest_buffer");
+ if (dest == null)
+ throw new ArgumentNullException ("dest");
if (index < 0)
throw new ArgumentOutOfRangeException ("index", "< 0");
if (count < 0)
throw new ArgumentOutOfRangeException ("count", "< 0");
// ordered to avoid possible integer overflow
- if (index > dest_buffer.Length - count)
- throw new ArgumentException ("index + count > dest_buffer.Length");
-
- int chars_read = 0;
- while (count > 0) {
- int c = Read ();
- if (c < 0)
- break;
- chars_read++;
- count--;
+ if (index > dest.Length - count)
+ throw new ArgumentException ("index + count > dest.Length");
- dest_buffer [index] = (char) c;
- //if (CheckEOL (dest_buffer [index++]))
- // return chars_read;
+ try {
+ return driver.Read (dest, index, count);
+ } catch (IOException) {
}
- return chars_read;
+
+ return 0;
}
public override string ReadLine ()
{
try {
- return ConsoleDriver.driver.ReadLine ();
+ return driver.ReadLine ();
} catch (IOException) {
}