MemoryMappedViewStream: ReadBlock

ReadBlock

Reads the specified number of bytes into the specified array.



 Public Function ReadBlock(
	  Buffer ( ) As Byte,
	  ByVal Offset As Long,
	  ByVal Count As Long ) As Long

Parameters

Buffer
[ByRef] Byte. The array to read the bytes into.
Offset
[ByVal] Long. The starting index in Buffer to begin reading to.
Count
[ByVal] Long. The number of bytes to read from the stream.

Return Values

Long -  The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.

Remarks

The offset parameter gives the offset of the byte in the array parameter (the buffer index) at which to begin reading, and the count parameter gives the maximum number of bytes to be read from this stream. The returned value is the actual number of bytes read, or zero if the end of the stream is reached.

Exceptions

Exception Condition
ObjectDisposedExceptionThe stream is closed.
NotSupportedExceptionThe CanRead property is set to False.
ArgumentNullExceptionThe Buffer parameter is set to null.
ArgumentOutOfRangeException The Offset parameter is less than lower bound of Buffer.
- or -
The Count parameter is less than zero.
ArgumentExceptionThe Offset parameter plus the Count parameter is greater than the upper bound of the buffer array.

See Also

Project CorLib Overview

Class MemoryMappedViewStream Overview