BufferedStream.CopyTo(Stream, Int32) 方法

定义

从当前缓冲流中读取字节并将其写入到其他流中。Reads the bytes from the current buffered stream and writes them to another 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)

参数

destination
Stream

将复制当前缓冲流的内容的流。The stream to which the contents of the current buffered stream will be copied.

bufferSize
Int32

缓冲区的大小。The size of the buffer. 此值必须大于零。This value must be greater than zero. 默认大小为 81920。The default size is 81920.

异常

destinationnulldestination is null.

bufferSize 为负数或零。bufferSize is negative or zero.

当前流不支持读取。The current stream does not support reading.

- 或 --or-

destination 不支持写入。destination does not support writing.

在调用 destination 方法前,当前流或 CopyTo(Stream) 已关闭。Either the current stream or destination was closed before the CopyTo(Stream) method was called.

出现 I/O 错误。An I/O error occurred.

适用于