Method RetrievePayloadFromHandle
RetrievePayloadFromHandle(PayloadHandle, out NativeArray<byte>)
Retrieves a NativeArray for the allocated memory block referenced by the specified handle.
Declaration
public bool RetrievePayloadFromHandle(PayloadHandle blockHandle, out NativeArray<byte> blockArray)
Parameters
Type | Name | Description |
---|---|---|
Payload |
blockHandle | Valid handle to the memory block to retrieve. |
Native |
blockArray | If successful, NativeArray as a view into the memory block. |
Returns
Type | Description |
---|---|
bool | True if successfully retrieved memory block and false if not. |
Remarks
NativeArray is read-only.
See Retrieve
RetrievePayloadFromHandle(PayloadHandle, bool, out NativeArray<byte>)
Retrieves a NativeArray for the allocated memory block referenced by the specified handle.
Declaration
public bool RetrievePayloadFromHandle(PayloadHandle blockHandle, bool readWriteAccess, out NativeArray<byte> blockArray)
Parameters
Type | Name | Description |
---|---|---|
Payload |
blockHandle | Valid handle to the memory block to retrieve. |
bool | readWriteAccess | True to give read-write access to the NativeArray and false for read-only access. |
Native |
blockArray | If successful, NativeArray as a view into the memory block. |
Returns
Type | Description |
---|---|
bool | True if successfully retrieved memory block and false if not. |
Remarks
The returned NativeArray is a view into the allocated memory block and not a copy, allows for safe access to them memory block. Access to the NativeArray can be specified as either read-only or read-write.
NOTE: Since the NativeArray is a view into a segment of native memory, a buffer overrun will corrupt the container causing undefined behavior.