docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method CopyToAsync

    CopyToAsync(Stream, int, CancellationToken)

    Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.

    Declaration
    public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    Stream destination

    The stream to which the contents of the current stream will be copied.

    int bufferSize

    The size, in bytes, of the buffer. This value must be greater than zero. The default size is 81920.

    CancellationToken cancellationToken

    The token to monitor for cancellation requests. The default value is None.

    Returns
    Type Description
    Task

    A task that represents the asynchronous copy operation.

    Overrides
    Stream.CopyToAsync(Stream, int, CancellationToken)
    Exceptions
    Type Condition
    ArgumentNullException

    destination is null.

    ArgumentOutOfRangeException

    buffersize is negative or zero.

    ObjectDisposedException

    Either the current stream or the destination stream is disposed.

    NotSupportedException

    The current stream does not support reading, or the destination stream does not support writing.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023