skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop

    Web

    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Test Studio Dev Edition Telerik JustMock

    CMS

    Sitefinity

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
  • Docs & Support
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class StreamExtensions

Extensions for the System.IO.Stream class.

Inheritance
System.Object
StreamExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
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 offset and (offset + count - 1) replaced by the bytes read from the current stream.

System.Int32 offset

The byte offset in buffer at which to begin storing the data read from the current stream.

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

buffer is null.

System.ArgumentOutOfRangeException

offset is outside the bounds of buffer. -or- count is negative. -or- The range specified by the combination of offset and count exceeds the length of buffer.

System.IO.EndOfStreamException

The end of the stream is reached before reading count number of bytes.

Getting Started
  • Getting Started
Support Resources
  • Documentation
Community
  • Forums
  • Blogs
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.