ערוך

שתף באמצעות


CryptoStream.CopyTo(Stream, Int32) Method

Definition

Reads the bytes from the underlying stream, applies the relevant cryptographic transforms, and writes the result to the destination stream.

public:
 override void CopyTo(System::IO::Stream ^ destination, int bufferSize);
public override void CopyTo (System.IO.Stream destination, int bufferSize);
override this.CopyTo : System.IO.Stream * int -> unit
Public Overrides Sub CopyTo (destination As Stream, bufferSize As Integer)

Parameters

destination
Stream

The stream to which the contents of the current stream will be copied.

bufferSize
Int32

The size, in bytes, of the buffer to use for reading from the underlying stream. This value must be greater than zero. The default size is 81920 bytes.

Exceptions

destination is null.

bufferSize is negative or zero.

The current stream does not support reading.

-or-

destination does not support writing.

Either the current stream or destination were closed before the CopyTo(Stream) method was called.

An I/O error occurred.

An error occurred during a cryptographic operation.

Remarks

Copying begins at the current position in the current stream, and does not reset the position of the destination stream after the copy operation is complete.

Applies to