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!

BufferedStream.Read

Copies bytes from the current buffered stream to an array.

[Visual Basic]
Overrides Public Function Read( _
   ByVal array() As Byte, _
   ByVal offset As Integer, _
   ByVal count As Integer _
) As Integer
[C#]
public override int Read(
   byte[] array,
   int offset,
   int count
);
[C++]
public: override int Read(
   unsigned char* array[],
   int offset,
   int count
);
[JScript]
public override function Read(
   array : Byte[],
   offset : int,
   count : int
) : int;

Parameters

array
The buffer to which bytes are to be copied.
offset
The byte offset in the buffer at which to begin reading bytes.
count
The number of bytes to be read.

Return Value

The total number of bytes read into array. This may be less than the number of bytes requested if that many bytes aren't currently available, or zero if the end of the stream has been reached before any data can be read.

Exceptions

Exception Type Condition
ArgumentException Length of array minus offset is less than count.
ArgumentNullException array is null.
ArgumentOutOfRangeException offset or count is less than zero.
IOException The stream is not open or is null.
NotSupportedException The stream does not support reading.

Remarks

Note that BufferedStream.Read(byte[], int, int) and BufferedStream.Write(byte[], int, int) read and write the number of bytes specified by the count parameter, while StreamReader.Read(char[], int, int) and StreamReader.Write(char[], int, int) read and write the number of characters specified by the count parameter. Use the BufferedStream methods only for reading and writing bytes.

The Read method will return zero only if the end of the stream is reached. In all other cases, Read always reads at least one byte from the stream before returning. If no data is available from the stream upon a call to Read, the method will block until at least one byte of data can be returned.

See Also

BufferedStream Class | BufferedStream Members | System.IO Namespace | BlockCopy | CanRead | Write