Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CopyTo() [2/2]

virtual void System.IO.Stream.CopyTo ( Stream destination,
int bufferSize )
inlinevirtualinherited

Reimplemented in System.IO.Compression.DeflateStream, System.IO.Compression.GZipStream, System.IO.Compression.ZLibStream, System.IO.ReadOnlyMemoryStream, System.Net.Http.Http2Connection.Http2Stream.Http2ReadStream, System.IO.Strategies.BufferedFileStreamStrategy, System.IO.BufferedStream, System.IO.FileStream, System.IO.MemoryStream, System.IO.Stream.NullStream, and System.Security.Cryptography.CryptoStream.

Definition at line 545 of file Stream.cs.

546 {
548 if (!CanRead)
549 {
550 if (CanWrite)
551 {
552 ThrowHelper.ThrowNotSupportedException_UnreadableStream();
553 }
554 ThrowHelper.ThrowObjectDisposedException_StreamClosed(GetType().Name);
555 }
556 byte[] array = ArrayPool<byte>.Shared.Rent(bufferSize);
557 try
558 {
559 int count;
560 while ((count = Read(array, 0, array.Length)) != 0)
561 {
562 destination.Write(array, 0, count);
563 }
564 }
565 finally
566 {
568 }
569 }
static ArrayPool< T > Shared
Definition ArrayPool.cs:7
static void ValidateCopyToArguments(Stream destination, int bufferSize)
Definition Stream.cs:1060

References System.array, System.IO.Stream.CanRead, System.IO.Stream.CanWrite, System.count, System.destination, System.Name, System.IO.Read, System.Buffers.ArrayPool< T >.Shared, System.ThrowHelper.ThrowNotSupportedException_UnreadableStream(), System.ThrowHelper.ThrowObjectDisposedException_StreamClosed(), and System.IO.Stream.ValidateCopyToArguments().