MetadataReaderProvider.FromMetadataStream(Stream, MetadataStreamOptions, Int32) 方法
定义
为具有指定大小且从其当前位置开头的流创建提供程序。Creates a provider for a stream of the specified size beginning at its current position.
public static System.Reflection.Metadata.MetadataReaderProvider FromMetadataStream (System.IO.Stream stream, System.Reflection.Metadata.MetadataStreamOptions options = System.Reflection.Metadata.MetadataStreamOptions.Default, int size = 0);
static member FromMetadataStream : System.IO.Stream * System.Reflection.Metadata.MetadataStreamOptions * int -> System.Reflection.Metadata.MetadataReaderProvider
Public Shared Function FromMetadataStream (stream As Stream, Optional options As MetadataStreamOptions = System.Reflection.Metadata.MetadataStreamOptions.Default, Optional size As Integer = 0) As MetadataReaderProvider
参数
- options
- MetadataStreamOptions
用于指定如何从流中读取映像分区的选项。Options specifying how sections of the image are read from the stream.
- size
- Int32
流中的元数据 blob 大小。Size of the metadata blob in the stream. 如果未指定,则假定元数据 blob 横跨到流的结尾。If not specified, the metadata blob is assumed to span to the end of the stream.
返回
新的提供程序。The new provider.
例外
stream 为 null。stream is null.
stream 不支持读取和查找操作。stream doesn't support read and seek operations.
大小为负,或者扩展超出了流的末尾。Size is negative or extends past the end of the stream.
从流中读取时出错(仅在指定 PrefetchMetadata 时读取)。Error reading from the stream (only when PrefetchMetadata is specified).
注解
除非 MetadataStreamOptions.LeaveOpen 指定,否则流的所有权将传输到成功的 MetadataReaderProvider 参数验证。Unless MetadataStreamOptions.LeaveOpen is specified, ownership of the stream is transferred to the MetadataReaderProvider upon successful argument validation. 它将由释放 MetadataReaderProvider ,并且调用方不能对其进行操作。It will be disposed by the MetadataReaderProvider, and the caller must not manipulate it.
除非 MetadataStreamOptions.PrefetchMetadata 指定,否则在构造过程中不会从流中读取任何数据 MetadataReaderProvider 。Unless MetadataStreamOptions.PrefetchMetadata is specified, no data is read from the stream during construction of the MetadataReaderProvider. 此外,当 MetadataReaderProvider 为活动和未释放时,不能由调用方对流进行操作。Furthermore, the stream must not be manipulated by caller while the MetadataReaderProvider is alive and undisposed.
如果 MetadataStreamOptions.PrefetchMetadata 为,则 MetadataReaderProvider 将读取在构造过程中请求的所有数据。If MetadataStreamOptions.PrefetchMetadata, the MetadataReaderProvider will have read all of the data requested during construction. 同样,如果 MetadataStreamOptions.LeaveOpen 指定了,则调用方将保留流的完全所有权,并确保在构造后不会对其进行操作 MetadataReaderProvider 。As such, if MetadataStreamOptions.LeaveOpen is also specified, the caller retains full ownership of the stream and is assured that it will not be manipulated by the MetadataReaderProvider after construction.