संपादित करें

इसके माध्यम से साझा किया गया


CryptoStream.Read(Byte[], Int32, Int32) Method

Definition

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

public:
 override int Read(cli::array <System::Byte> ^ buffer, int offset, int count);
public override int Read (byte[] buffer, int offset, int count);
override this.Read : byte[] * int * int -> int
Public Overrides Function Read (buffer As Byte(), offset As Integer, count As Integer) As Integer

Parameters

buffer
Byte[]

An array of bytes. A maximum of count bytes are read from the current stream and stored in buffer.

offset
Int32

The byte offset in buffer at which to begin storing the data read from the current stream.

count
Int32

The maximum number of bytes to be read from the current stream.

Returns

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.

Exceptions

The CryptoStreamMode associated with current CryptoStream object does not match the underlying stream. For example, this exception is thrown when using Read with an underlying stream that is write only.

offset or count is less than zero.

The sum of the count and offset parameters is longer than the length of the buffer.

Remarks

Starting in .NET 6, this method might not read as many bytes as were requested. For more information, see Partial and zero-byte reads in DeflateStream, GZipStream, and CryptoStream.

Applies to

See also