[Mono-list] [Fwd: [Mono-cvs-list] Mono CVS: mcs gonzalo]

Gonzalo Paniagua Javier gonzalo@gnome-db.org
Wed, 3 Jul 2002 16:29:08 +0200


* [ Dick Porter <dick@ximian.com>
* Wed, 03 Jul 2002 12:24:44 +0200 ]
> > "The current position of the StreamReader is not changed by Peek. The
> > returned value is -1 if no more characters are currently available."
> > 
> > The behavior under remarks is the one i noticed, cause i run the same
> > code under MS (wrapping a NetworkStream in a StreamReader) with no
> > problem.
> 
> Those two statements are not mutually exclusive.  They say:

Oh, may be i should have quoted only the second phrase, which was the
one i wanted to point out, cause it does not mention anything about seek
capability.

Btw, mkestner already provided a solution for the problem that was
fixing ReadLine not to use Peek. Thanks.

Btw2: yesterday i proved that Peek does not call CanSeek. So our current
Peek implementation won't let me peek a char if the underlying stream is
a NetworkStream, while MS impl. let me do it.

We don't need to check for seek capabilities cause we don't need them.
We only need to read 1 more char and keep it buffered for the next Read.
Does that require any seek?


-- 
Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
http://www.gnome-db.org/~gonzalo/