Class StreamExtensions
Extensions for the System.IO.Stream class.
Inheritance
Inherited Members
Namespace: Telerik.Windows.Zip.Utilities
Assembly: Telerik.Windows.Zip.dll
Syntax
public static class StreamExtensions
Methods
CopyToAsync(Stream, Stream, CancellationToken)
Asynchronously reads the bytes from the current stream and writes them to another stream. Both streams positions are advanced by the number of bytes copied.
Declaration
public static Task CopyToAsync(this Stream source, Stream destination, CancellationToken cancellationToken)
Parameters
System.IO.Stream
source
|
System.IO.Stream
destination
The stream to which the contents of the current stream will be copied. |
System.Threading.CancellationToken
cancellationToken
The token to monitor for cancellation requests. |
Returns
System.Threading.Tasks.Task
A task that represents the asynchronous copy operation. |
ReadExactly(Stream, Byte[], Int32, Int32)
Reads count
number of bytes from the current stream and advances the position within the stream.
Declaration
public static byte[] ReadExactly(this Stream stream, byte[] buffer, int offset, int count)
Parameters
System.IO.Stream
stream
The stream to read from. |
System.Byte[]
buffer
An array of bytes. When this method returns, the buffer contains the specified byte array with the values
between |
System.Int32
offset
The byte offset in |
System.Int32
count
The number of bytes to be read from the current stream. |
Returns
System.Byte[]
|
Remarks
When count
is 0 (zero), this read operation will be completed without waiting for available data in the stream.
Exceptions
System.ArgumentNullException
|
System.ArgumentOutOfRangeException
|
System.IO.EndOfStreamException
The end of the stream is reached before reading |