* Load bytearray as bytes from ptr. * @param byteArrayPtr The head address of the bytearray.
(byteArrayPtr: Pointer)
| 242 | * @param byteArrayPtr The head address of the bytearray. |
| 243 | */ |
| 244 | loadByteArrayAsBytes(byteArrayPtr: Pointer): Uint8Array { |
| 245 | if (this.buffer != this.memory.buffer) { |
| 246 | this.updateViews(); |
| 247 | } |
| 248 | const ptr = this.loadPointer(byteArrayPtr); |
| 249 | const length = this.loadUSize(byteArrayPtr + this.sizeofPtr()); |
| 250 | const result = new Uint8Array(length); |
| 251 | result.set(this.viewU8.slice(ptr, ptr + length)); |
| 252 | return result; |
| 253 | } |
| 254 | // private functions |
| 255 | /** |
| 256 | * Update memory view after the memory growth. |
no test coverage detected