CryptoStream: CopyTo

CopyTo

Reads the bytes from the current stream and writes them to another stream.



 Public Sub CopyTo(
	  ByVal Destination As Stream,
	  Optional ByVal BufferSize As Long = 81920 )

Parameters

Destination
[ByVal] Stream. The stream to which the contents of the current stream will be copied.
BufferSize
[ByVal] Optional. Long. The size of the buffer. This value must be greater than zero. The default size is 81920.  

Default: 81920

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.

Exceptions

Exception Condition
ArgumentNullExceptionDestination is Nothing.
NotSupportedException The current stream does not support reading.
-or-
Destination does not support writing.
ObjectDisposedExceptionEither the current stream or Destination were closed before the CopyTo method was called.
IOExceptionAn I/O error occurred.

See Also

Project CorLib Overview

Class CryptoStream Overview