CryptoStream.Write(Byte[], Int32, Int32) 方法

定义

将一字节序列写入当前的 CryptoStream,并将通过写入的字节数提前该流的当前位置。Writes a sequence of bytes to the current CryptoStream and advances the current position within the stream by the number of bytes written.

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

参数

buffer
Byte[]

字节数组。An array of bytes. 此方法将 count 个字节从 buffer 复制到当前流。This method copies count bytes from buffer to the current stream.

offset
Int32

buffer 中的字节偏移量,从此偏移量开始将字节复制到当前流。The byte offset in buffer at which to begin copying bytes to the current stream.

count
Int32

要写入当前流的字节数。The number of bytes to be written to the current stream.

异常

与当前 CryptoStreamMode 对象关联的 CryptoStream 与基础流不匹配。The CryptoStreamMode associated with current CryptoStream object does not match the underlying stream. 例如,对只读的基础流使用 Write 时会引发此异常。For example, this exception is thrown when using Write with an underlying stream that is read only.

offset 参数小于零。The offset parameter is less than zero.

- 或 --or- count 参数小于零。The count parameter is less than zero.

count 参数和 offset 参数的和比缓冲区的长度长。The sum of the count and offset parameters is longer than the length of the buffer.

适用于

另请参阅