Editare

Partajați prin


UnmanagedMemoryStream.Initialize Method

Definition

Initializes a new instance of the UnmanagedMemoryStream class in a safe buffer, or by using a pointer to an unmanaged memory location.

Overloads

Initialize(Byte*, Int64, Int64, FileAccess)

Initializes a new instance of the UnmanagedMemoryStream class by using a pointer to an unmanaged memory location.

Initialize(SafeBuffer, Int64, Int64, FileAccess)

Initializes a new instance of the UnmanagedMemoryStream class in a safe buffer with a specified offset, length, and file access.

Initialize(Byte*, Int64, Int64, FileAccess)

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

Important

This API is not CLS-compliant.

Initializes a new instance of the UnmanagedMemoryStream class by using a pointer to an unmanaged memory location.

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

Parameters

pointer
Byte*

A pointer to an unmanaged memory location.

length
Int64

The length of the memory to use.

capacity
Int64

The total amount of memory assigned to the stream.

access
FileAccess

One of the FileAccess values.

Attributes

Exceptions

The user does not have the required permission.

The pointer value is null.

The length value is less than zero.

-or-

The capacity value is less than zero.

-or-

The length value is large enough to cause an overflow.

Remarks

This method is equivalent to the UnmanagedMemoryStream constructor. It supports methods that need to initialize the pointer before setting stream variables and, therefore, cannot call the parameterized constructor. Such methods should use the parameterless constructor, UnmanagedMemoryStream(), initialize the pointer, and then invoke the Initialize method.

Applies to

Initialize(SafeBuffer, Int64, Int64, FileAccess)

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

Initializes a new instance of the UnmanagedMemoryStream class in a safe buffer with a specified offset, length, and file access.

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)

Parameters

buffer
SafeBuffer

The buffer to contain the unmanaged memory stream.

offset
Int64

The byte position in the buffer at which to start the unmanaged memory stream.

length
Int64

The length of the unmanaged memory stream.

access
FileAccess

The mode of file access to the unmanaged memory stream.

Applies to