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.

適用於