UnmanagedMemoryStream.Initialize 方法

定义

在安全缓冲区中初始化类的新实例 UnmanagedMemoryStream ,或使用指向非托管内存位置的指针。

重载

名称 说明
Initialize(Byte*, Int64, Int64, FileAccess)

使用指向非托管内存位置的 UnmanagedMemoryStream 指针初始化类的新实例。

Initialize(SafeBuffer, Int64, Int64, FileAccess)

使用指定的偏移量、长度和文件访问初始化安全缓冲区中类的新实例 UnmanagedMemoryStream

Initialize(Byte*, Int64, Int64, FileAccess)

Source:
UnmanagedMemoryStream.cs
Source:
UnmanagedMemoryStream.cs
Source:
UnmanagedMemoryStream.cs
Source:
UnmanagedMemoryStream.cs
Source:
UnmanagedMemoryStream.cs

重要

此 API 不符合 CLS。

使用指向非托管内存位置的 UnmanagedMemoryStream 指针初始化类的新实例。

protected:
 void Initialize(System::Byte* pointer, long length, long capacity, System::IO::FileAccess access);
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
protected void Initialize(byte* pointer, long length, long capacity, System.IO.FileAccess access);
[System.CLSCompliant(false)]
protected void Initialize(byte* pointer, long length, long capacity, System.IO.FileAccess access);
protected void Initialize(byte* pointer, long length, long capacity, System.IO.FileAccess access);
[<System.CLSCompliant(false)>]
[<System.Security.SecurityCritical>]
member this.Initialize : nativeptr<byte> * int64 * int64 * System.IO.FileAccess -> unit
[<System.CLSCompliant(false)>]
member this.Initialize : nativeptr<byte> * int64 * int64 * System.IO.FileAccess -> unit
member this.Initialize : nativeptr<byte> * int64 * int64 * System.IO.FileAccess -> unit

参数

pointer
Byte*

指向非托管内存位置的指针。

length
Int64

要使用的内存的长度。

capacity
Int64

分配给流的内存总量。

access
FileAccess

其中一个 FileAccess 值。

属性

例外

用户没有所需的权限。

值为 pointernull.

该值 length 小于零。

-或-

该值 capacity 小于零。

-或-

该值 length 足够大,导致溢出。

注解

此方法等效于 UnmanagedMemoryStream 构造函数。 它支持在设置流变量之前需要初始化指针的方法,因此无法调用参数化构造函数。 此类方法应使用无参数构造函数, UnmanagedMemoryStream()初始化指针,然后调用 Initialize 该方法。

适用于

Initialize(SafeBuffer, Int64, Int64, FileAccess)

Source:
UnmanagedMemoryStream.cs
Source:
UnmanagedMemoryStream.cs
Source:
UnmanagedMemoryStream.cs
Source:
UnmanagedMemoryStream.cs
Source:
UnmanagedMemoryStream.cs

使用指定的偏移量、长度和文件访问初始化安全缓冲区中类的新实例 UnmanagedMemoryStream

protected:
 void Initialize(System::Runtime::InteropServices::SafeBuffer ^ buffer, long offset, long length, System::IO::FileAccess access);
protected void Initialize(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length, System.IO.FileAccess access);
member this.Initialize : System.Runtime.InteropServices.SafeBuffer * int64 * int64 * System.IO.FileAccess -> unit
Protected Sub Initialize (buffer As SafeBuffer, offset As Long, length As Long, access As FileAccess)

参数

buffer
SafeBuffer

要包含非托管内存流的缓冲区。

offset
Int64

缓冲区中要启动非托管内存流的字节位置。

length
Int64

非托管内存流的长度。

access
FileAccess

对非托管内存流的文件访问模式。

适用于