MemoryStream.CopyTo(Stream, Int32) 方法
定义
使用指定的缓冲区大小,从当前内存流中读取字节并将其写入到另一流中。Reads the bytes from the current memory stream and writes them to another stream, using a specified buffer size.
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 memory stream will be copied.
- bufferSize
- Int32
缓冲区的大小。The size of the buffer. 此值必须大于零。This value must be greater than zero. 默认大小为 81920。The default size is 81920.
例外
destination 为 null。destination is null.
bufferSize 不是正数。bufferSize is not a positive number.
基础内存流或 destination 流已关闭。Either the underlying memory stream or the destination stream is closed.
基础内存流不可读取。The underlying memory stream is unreadable.
- 或 --or-
destination 流不可写入。The destination stream is unwritable.