CryptoStream: ReadBlock

ReadBlock

Reads a sequence of bytes from the current CryptoStream and advances the position within the stream by the number of bytes read.



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

Parameters

Buffer
[ByRef] Byte. An array of bytes. A maximum of Count bytes are read from the current stream and stored in Buffer.
Offset
[ByVal] Long. The byte offset in Buffer at which to begin storing the data read from the current stream.
Count
[ByVal] Long. The maximum number of bytes to be read from the current 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 if the end of the stream has been reached.
Exception Condition
NotSupportedException The CryptoStreamMode associated with current CryptoStream object does not match the underlying stream. For example, this exception is thrown when using ReadMode with an underlying stream that is write only.
ArgumentOutOfRangeException The Offset parameter is less than zero.
-or-
The Count parameter is less than zero.
ArgumentExceptionThe sum of the Count and Offset parameters is longer than the length of the Buffer.

See Also

Project CorLib Overview

Class CryptoStream Overview