NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Stream.ReadByte

Reads a byte from the current position in the stream, or-1 if at the end of the stream.

[Visual Basic]
Overridable Public Function ReadByte() As Integer
[C#]
public virtual int ReadByte();
[C++]
public: virtual int ReadByte();
[JScript]
public function ReadByte() : int;

Return Value

The unsigned byte cast to an int, or-1 if at the end of the stream.

Exceptions

Exception Type Condition
IOException The stream is closed.
NotSupportedException The stream does not support reading.

Remarks

If the stream is closed or not readable, an exception will be thrown.

The implementation on Stream creates a new one-byte array and then calls Read (byte[], int,

int). While this is formally correct, it is inefficient. Any stream with an internal buffer should override this method and provide a much more efficient version that reads their buffer directly, avoiding the extra array allocation on every call.

See Also

Stream Class | Stream Members | System.IO Namespace