Stream Stream Stream Stream Class

定义

提供字节序列的一般视图。Provides a generic view of a sequence of bytes. 这是一个抽象类。This is an abstract class.

public ref class Stream abstract : MarshalByRefObject, IDisposable
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public abstract class Stream : MarshalByRefObject, IDisposable
type Stream = class
    inherit MarshalByRefObject
    interface IDisposable
Public MustInherit Class Stream
Inherits MarshalByRefObject
Implements IDisposable
继承
派生
属性
实现

示例

下面的示例演示如何使用两个FileStream对象以异步方式将文件从一个目录复制到另一个目录。The following example demonstrates how to use two FileStream objects to asynchronously copy the files from one directory to another directory. FileStream 类是从 Stream 类派生的。The FileStream class derives from the Stream class. 需要注意 Click 控件的 Button 事件处理程序具有 async 修饰符标记,因为它调用异步方法。Notice that the Click event handler for the Button control is marked with the async modifier because it calls an asynchronous method.

using System;
using System.Threading.Tasks;
using System.Windows;
using System.IO;

namespace WpfApplication
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            string StartDirectory = @"c:\Users\exampleuser\start";
            string EndDirectory = @"c:\Users\exampleuser\end";

            foreach (string filename in Directory.EnumerateFiles(StartDirectory))
            {
                using (FileStream SourceStream = File.Open(filename, FileMode.Open))
                {
                    using (FileStream DestinationStream = File.Create(EndDirectory + filename.Substring(filename.LastIndexOf('\\'))))
                    {
                        await SourceStream.CopyToAsync(DestinationStream);
                    }
                }
            }
        }
    }
}
Imports System.IO

Class MainWindow

    Private Async Sub Button_Click(sender As Object, e As RoutedEventArgs)
        Dim StartDirectory As String = "c:\Users\exampleuser\start"
        Dim EndDirectory As String = "c:\Users\exampleuser\end"

        For Each filename As String In Directory.EnumerateFiles(StartDirectory)
            Using SourceStream As FileStream = File.Open(filename, FileMode.Open)
                Using DestinationStream As FileStream = File.Create(EndDirectory + filename.Substring(filename.LastIndexOf("\"c)))
                    Await SourceStream.CopyToAsync(DestinationStream)
                End Using

            End Using
        Next
    End Sub

End Class

注解

Stream 是所有流的抽象基类。Stream is the abstract base class of all streams. 流是字节序列的抽象,例如文件、输入/输出设备、进程中通信管道或 TCP/IP 套接字。A stream is an abstraction of a sequence of bytes, such as a file, an input/output device, an inter-process communication pipe, or a TCP/IP socket. Stream类和其派生的类提供的输入和输出,这些不同类型的一般视图,并使程序员不必了解操作系统和基础设备的具体细节。The Stream class and its derived classes provide a generic view of these different types of input and output, and isolate the programmer from the specific details of the operating system and the underlying devices.

流涉及三个基本操作:Streams involve three fundamental operations:

  • 您可以从流中读取。You can read from streams. 读取是将数据从一个流传送到数据结构,如字节数组。Reading is the transfer of data from a stream into a data structure, such as an array of bytes.

  • 可以写入流。You can write to streams. 写作是数据的数据结构传输到流。Writing is the transfer of data from a data structure into a stream.

  • 流可以支持查找。Streams can support seeking. 查找引用查询和修改流中的当前位置。Seeking refers to querying and modifying the current position within a stream. 查找功能取决于流有的后备存储的类型。Seek capability depends on the kind of backing store a stream has. 例如,网络流的当前位置,没有统一概念,并且因此通常不支持搜寻。For example, network streams have no unified concept of a current position, and therefore typically do not support seeking.

一些较常用的流的继承StreamFileStream,和MemoryStreamSome of the more commonly used streams that inherit from Stream are FileStream, and MemoryStream.

根据基础数据源或存储库,流可能支持仅某些功能。Depending on the underlying data source or repository, streams might support only some of these capabilities. 可以通过使用查询流的功能CanReadCanWrite,并CanSeek的属性Stream类。You can query a stream for its capabilities by using the CanRead, CanWrite, and CanSeek properties of the Stream class.

ReadWrite方法读取和写入不同的格式的数据。The Read and Write methods read and write data in a variety of formats. 对于支持查找的流,使用SeekSetLength方法并PositionLength属性,以查询和修改的当前位置和流的长度。For streams that support seeking, use the Seek and SetLength methods and the Position and Length properties to query and modify the current position and length of a stream.

此类型实现IDisposable接口。This type implements the IDisposable interface. 在使用完类型后,您应直接或间接释放类型。When you have finished using the type, you should dispose of it either directly or indirectly. 若要直接释放类型,调用其Dispose中的方法try / catch块。To dispose of the type directly, call its Dispose method in a try/catch block. 若要间接释放类型,请使用 using(在 C# 中)或 Using(在 Visual Basic 中)等语言构造。To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). 有关详细信息,请参阅中的"使用对象实现 IDisposable"一节IDisposable接口主题。For more information, see the "Using an Object that Implements IDisposable" section in the IDisposable interface topic.

释放Stream对象会刷新所有缓冲的数据,并实质上是调用Flush为您的方法。Disposing a Stream object flushes any buffered data, and essentially calls the Flush method for you. Dispose 也会释放操作系统资源,例如文件句柄、 网络连接或用于任何内部缓冲的内存。Dispose also releases operating system resources such as file handles, network connections, or memory used for any internal buffering. BufferedStream类提供的另一个流以便提高读取和写入性能周围包装缓冲的流的功能。The BufferedStream class provides the capability of wrapping a buffered stream around another stream in order to improve read and write performance.

从开始.NET Framework 4.5.NET Framework 4.5,则Stream类包括异步方法来简化异步操作。Starting with the .NET Framework 4.5.NET Framework 4.5, the Stream class includes async methods to simplify asynchronous operations. 异步方法包含Async中其名称,如ReadAsyncWriteAsyncCopyToAsync,和FlushAsyncAn async method contains Async in its name, such as ReadAsync, WriteAsync, CopyToAsync, and FlushAsync. 这些方法,可执行占用大量资源的 I/O 操作而不会阻止主线程。These methods enable you to perform resource-intensive I/O operations without blocking the main thread. Windows 8.x 应用商店Windows 8.x Store 应用或 桌面desktop 应用中一个耗时的流操作可能阻塞 UI 线程并让您的应用看起来好像不工作时,这种性能的考虑就显得尤为重要了。This performance consideration is particularly important in a Windows 8.x 应用商店Windows 8.x Store app or 桌面desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. 结合使用异步方法asyncawaitVisual Basic 和 C# 中的关键字。The async methods are used in conjunction with the async and await keywords in Visual Basic and C#.

在中使用时Windows 8.x 应用商店Windows 8.x Store应用程序中,Stream包括两个扩展方法:AsInputStreamAsOutputStreamWhen used in a Windows 8.x 应用商店Windows 8.x Store app, Stream includes two extension methods: AsInputStream and AsOutputStream. 这些方法将转换Stream向流中的对象Windows 运行时Windows RuntimeThese methods convert a Stream object to a stream in the Windows 运行时Windows Runtime. 此外可以将转换中的流Windows 运行时Windows RuntimeStream通过使用对象AsStreamForReadAsStreamForWrite方法。You can also convert a stream in the Windows 运行时Windows Runtime to a Stream object by using the AsStreamForRead and AsStreamForWrite methods. 有关详细信息,请参阅如何:在 .NET Framework 流和 Windows 运行时流之间进行转换For more information, see How to: Convert Between .NET Framework Streams and Windows Runtime Streams

某些流实现执行本地缓冲的基础数据以提高性能。Some stream implementations perform local buffering of the underlying data to improve performance. 对于此类流,你可以使用FlushFlushAsync方法以清除所有内部缓冲区并确保所有数据,已都写入到基础数据源或存储库。For such streams, you can use the Flush or FlushAsync method to clear any internal buffers and ensure that all data has been written to the underlying data source or repository.

如果你需要具有无后备存储 (也称为位存储桶) 的流,使用Null检索为此目的设计的流的实例字段。If you need a stream with no backing store (also known as a bit bucket), use the Null field to retrieve an instance of a stream that is designed for this purpose.

继承者说明

当实现的派生的类Stream,必须提供实现Read(Byte[], Int32, Int32)Write(Byte[], Int32, Int32)方法。When you implement a derived class of Stream, you must provide implementations for the Read(Byte[], Int32, Int32) and Write(Byte[], Int32, Int32) methods. 异步方法ReadAsync(Byte[], Int32, Int32)WriteAsync(Byte[], Int32, Int32),并CopyToAsync(Stream)使用同步方法Read(Byte[], Int32, Int32)Write(Byte[], Int32, Int32)在其实现中。The asynchronous methods ReadAsync(Byte[], Int32, Int32), WriteAsync(Byte[], Int32, Int32), and CopyToAsync(Stream) use the synchronous methods Read(Byte[], Int32, Int32) and Write(Byte[], Int32, Int32) in their implementations. 因此,您的实现Read(Byte[], Int32, Int32)Write(Byte[], Int32, Int32)使用异步方法将正常工作。Therefore, your implementations of Read(Byte[], Int32, Int32) and Write(Byte[], Int32, Int32) will work correctly with the asynchronous methods. 默认实现ReadByte()WriteByte(Byte)创建一个新的单元素字节数组,然后调用在实现Read(Byte[], Int32, Int32)Write(Byte[], Int32, Int32)The default implementations of ReadByte() and WriteByte(Byte) create a new single-element byte array, and then call your implementations of Read(Byte[], Int32, Int32) and Write(Byte[], Int32, Int32). 从类派生时Stream,我们建议您重写这些方法以访问内部缓冲区,如果你有帐户,以显著提高性能。When you derive from Stream, we recommend that you override these methods to access your internal buffer, if you have one, for substantially better performance. 你还必须提供的实现CanReadCanSeekCanWriteFlush()LengthPositionSeek(Int64, SeekOrigin),和SetLength(Int64)You must also provide implementations of CanRead, CanSeek, CanWrite, Flush(), Length, Position, Seek(Int64, SeekOrigin), and SetLength(Int64).

不会重写Close()方法,而是将所有Stream中的清除逻辑Dispose(Boolean)方法。Do not override the Close() method, instead, put all the Stream cleanup logic in the Dispose(Boolean) method. 有关详细信息,请参阅实现 Dispose 方法For more information, see Implementing a Dispose Method.

构造函数

Stream() Stream() Stream() Stream()

初始化 Stream 类的新实例。Initializes a new instance of the Stream class.

字段

Null Null Null Null

无后备存储区的 StreamA Stream with no backing store.

属性

CanRead CanRead CanRead CanRead

当在派生类中重写时,获取指示当前流是否支持读取的值。When overridden in a derived class, gets a value indicating whether the current stream supports reading.

CanSeek CanSeek CanSeek CanSeek

当在派生类中重写时,获取指示当前流是否支持查找功能的值。When overridden in a derived class, gets a value indicating whether the current stream supports seeking.

CanTimeout CanTimeout CanTimeout CanTimeout

获取一个值,该值确定当前流是否可以超时。Gets a value that determines whether the current stream can time out.

CanWrite CanWrite CanWrite CanWrite

当在派生类中重写时,获取指示当前流是否支持写入功能的值。When overridden in a derived class, gets a value indicating whether the current stream supports writing.

Length Length Length Length

当在派生类中重写时,获取流长度(以字节为单位)。When overridden in a derived class, gets the length in bytes of the stream.

Position Position Position Position

当在派生类中重写时,获取或设置当前流中的位置。When overridden in a derived class, gets or sets the position within the current stream.

ReadTimeout ReadTimeout ReadTimeout ReadTimeout

获取或设置一个值(以毫秒为单位),该值确定流在超时前尝试读取多长时间。Gets or sets a value, in milliseconds, that determines how long the stream will attempt to read before timing out.

WriteTimeout WriteTimeout WriteTimeout WriteTimeout

获取或设置一个值(以毫秒为单位),该值确定流在超时前尝试写入多长时间。Gets or sets a value, in milliseconds, that determines how long the stream will attempt to write before timing out.

方法

BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)

开始异步读操作。Begins an asynchronous read operation. (请考虑改用 ReadAsync(Byte[], Int32, Int32)。)(Consider using ReadAsync(Byte[], Int32, Int32) instead.)

BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)

开始异步写操作。Begins an asynchronous write operation. (请考虑改用 WriteAsync(Byte[], Int32, Int32)。)(Consider using WriteAsync(Byte[], Int32, Int32) instead.)

Close() Close() Close() Close()

关闭当前流并释放与之关联的所有资源(如套接字和文件句柄)。Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. 不直接调用此方法,而应确保流得以正确释放。Instead of calling this method, ensure that the stream is properly disposed.

CopyTo(Stream) CopyTo(Stream) CopyTo(Stream) CopyTo(Stream)

从当前流中读取字节并将其写入到另一流中。Reads the bytes from the current stream and writes them to another stream.

CopyTo(Stream, Int32) CopyTo(Stream, Int32) CopyTo(Stream, Int32) CopyTo(Stream, Int32)

使用指定的缓冲区大小,从当前流中读取字节并将其写入到另一流中。Reads the bytes from the current stream and writes them to another stream, using a specified buffer size.

CopyToAsync(Stream) CopyToAsync(Stream) CopyToAsync(Stream) CopyToAsync(Stream)

从当前流中异步读取字节并将其写入到另一个流中。Asynchronously reads the bytes from the current stream and writes them to another stream.

CopyToAsync(Stream, CancellationToken) CopyToAsync(Stream, CancellationToken) CopyToAsync(Stream, CancellationToken) CopyToAsync(Stream, CancellationToken)
CopyToAsync(Stream, Int32) CopyToAsync(Stream, Int32) CopyToAsync(Stream, Int32) CopyToAsync(Stream, Int32)

使用指定的缓冲区大小,从当前流中异步读取字节并将其写入到另一流中。Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size.

CopyToAsync(Stream, Int32, CancellationToken) CopyToAsync(Stream, Int32, CancellationToken) CopyToAsync(Stream, Int32, CancellationToken) CopyToAsync(Stream, Int32, CancellationToken)

使用指定的缓冲区大小和取消令牌,从当前流中异步读取字节并将其写入到另一个流中。Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
CreateWaitHandle() CreateWaitHandle() CreateWaitHandle() CreateWaitHandle()

分配 WaitHandle 对象。Allocates a WaitHandle object.

Dispose() Dispose() Dispose() Dispose()

释放由 Stream 使用的所有资源。Releases all resources used by the Stream.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

释放由 Stream 占用的非托管资源,还可以另外再释放托管资源。Releases the unmanaged resources used by the Stream and optionally releases the managed resources.

DisposeAsync() DisposeAsync() DisposeAsync() DisposeAsync()
EndRead(IAsyncResult) EndRead(IAsyncResult) EndRead(IAsyncResult) EndRead(IAsyncResult)

等待挂起的异步读取完成。Waits for the pending asynchronous read to complete. (请考虑改用 ReadAsync(Byte[], Int32, Int32)。)(Consider using ReadAsync(Byte[], Int32, Int32) instead.)

EndWrite(IAsyncResult) EndWrite(IAsyncResult) EndWrite(IAsyncResult) EndWrite(IAsyncResult)

结束异步写操作。Ends an asynchronous write operation. (请考虑改用 WriteAsync(Byte[], Int32, Int32)。)(Consider using WriteAsync(Byte[], Int32, Int32) instead.)

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
Flush() Flush() Flush() Flush()

当在派生类中重写时,将清除该流的所有缓冲区,并使得所有缓冲数据被写入到基础设备。When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.

FlushAsync() FlushAsync() FlushAsync() FlushAsync()

异步清除此流的所有缓冲区并导致所有缓冲数据都写入基础设备中。Asynchronously clears all buffers for this stream and causes any buffered data to be written to the underlying device.

FlushAsync(CancellationToken) FlushAsync(CancellationToken) FlushAsync(CancellationToken) FlushAsync(CancellationToken)

异步清理这个流的所有缓冲区,并使所有缓冲数据写入基础设备,并且监控取消请求。Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
ObjectInvariant() ObjectInvariant() ObjectInvariant() ObjectInvariant()

提供对 Contract 的支持。Provides support for a Contract.

Read(Byte[], Int32, Int32) Read(Byte[], Int32, Int32) Read(Byte[], Int32, Int32) Read(Byte[], Int32, Int32)

当在派生类中重写时,从当前流读取字节序列,并将此流中的位置提升读取的字节数。When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

Read(Span<Byte>) Read(Span<Byte>) Read(Span<Byte>) Read(Span<Byte>)
ReadAsync(Byte[], Int32, Int32) ReadAsync(Byte[], Int32, Int32) ReadAsync(Byte[], Int32, Int32) ReadAsync(Byte[], Int32, Int32)

从当前流异步读取字节序列,并将流中的位置提升读取的字节数。Asynchronously reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

ReadAsync(Byte[], Int32, Int32, CancellationToken) ReadAsync(Byte[], Int32, Int32, CancellationToken) ReadAsync(Byte[], Int32, Int32, CancellationToken) ReadAsync(Byte[], Int32, Int32, CancellationToken)

从当前流异步读取字节的序列,将流中的位置提升读取的字节数,并监视取消请求。Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.

ReadAsync(Memory<Byte>, CancellationToken) ReadAsync(Memory<Byte>, CancellationToken) ReadAsync(Memory<Byte>, CancellationToken) ReadAsync(Memory<Byte>, CancellationToken)
ReadByte() ReadByte() ReadByte() ReadByte()

从流中读取一个字节,并将流内的位置向前提升一个字节,或者如果已到达流结尾,则返回 -1。Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.

Seek(Int64, SeekOrigin) Seek(Int64, SeekOrigin) Seek(Int64, SeekOrigin) Seek(Int64, SeekOrigin)

当在派生类中重写时,设置当前流中的位置。When overridden in a derived class, sets the position within the current stream.

SetLength(Int64) SetLength(Int64) SetLength(Int64) SetLength(Int64)

当在派生类中重写时,设置当前流的长度。When overridden in a derived class, sets the length of the current stream.

Synchronized(Stream) Synchronized(Stream) Synchronized(Stream) Synchronized(Stream)

在指定的 Stream 对象周围创建线程安全(同步)包装。Creates a thread-safe (synchronized) wrapper around the specified Stream object.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)
Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32)

当在派生类中重写时,向当前流中写入字节序列,并将此流中的当前位置提升写入的字节数。When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>)
WriteAsync(Byte[], Int32, Int32) WriteAsync(Byte[], Int32, Int32) WriteAsync(Byte[], Int32, Int32) WriteAsync(Byte[], Int32, Int32)

将字节序列异步写入当前流,并将流的当前位置提升写入的字节数。Asynchronously writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

WriteAsync(Byte[], Int32, Int32, CancellationToken) WriteAsync(Byte[], Int32, Int32, CancellationToken) WriteAsync(Byte[], Int32, Int32, CancellationToken) WriteAsync(Byte[], Int32, Int32, CancellationToken)

将字节的序列异步写入当前流,将该流中的当前位置向前移动写入的字节数,并监视取消请求。Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

WriteAsync(ReadOnlyMemory<Byte>, CancellationToken) WriteAsync(ReadOnlyMemory<Byte>, CancellationToken) WriteAsync(ReadOnlyMemory<Byte>, CancellationToken) WriteAsync(ReadOnlyMemory<Byte>, CancellationToken)
WriteByte(Byte) WriteByte(Byte) WriteByte(Byte) WriteByte(Byte)

将一个字节写入流内的当前位置,并将流内的位置向前提升一个字节。Writes a byte to the current position in the stream and advances the position within the stream by one byte.

显式界面实现

IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose()

释放由 Stream 使用的所有资源。Releases all resources used by the Stream.

Extension Methods

AsInputStream(Stream) AsInputStream(Stream) AsInputStream(Stream) AsInputStream(Stream)

将适用于 Windows 应用商店应用的 .NET 中的托管流转换为 Windows 运行时中的输入流。Converts a managed stream in the .NET for Windows Store apps to an input stream in the Windows Runtime.

AsOutputStream(Stream) AsOutputStream(Stream) AsOutputStream(Stream) AsOutputStream(Stream)

将适用于 Windows 应用商店应用的 .NET 中的托管流转换为 Windows 运行时中的输出流。Converts a managed stream in the .NET for Windows Store apps to an output stream in the Windows Runtime.

AsRandomAccessStream(Stream) AsRandomAccessStream(Stream) AsRandomAccessStream(Stream) AsRandomAccessStream(Stream)

将指定的流转换为随机访问流。Converts the specified stream to a random access stream.

适用于

另请参阅