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

Dick Porter dick@ximian.com
Wed, 3 Jul 2002 11:10:05 +0100


On Wed, Jul 03, 2002 at 01:41:14AM +0200, Gonzalo Paniagua Javier wrote:
> * [ Mike Kestner <mkestner@speakeasy.net>
> * Tue, 02 Jul 2002 23:45:21 +0200 ]
> > Besides, the MS docs on the method > explicitly state that -1 is
> > supposed to be returned if Peek is called on a non-seekable stream.
> 
> Mmm, strange, in the MS docs, they say under "Return Value":
> 
> "The next character to be read, or -1 if no more characters are
> available or the stream does not support seeking"
> 
> but under "Remarks":
> 
> "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:

push(read position)
if(stream supports seeking) {
	if(more characters available) {
		next char
	} else {
		-1
	}
} else {
	-1
}
pop(read position)

- Dick