``insert`` inserts the bytes in ``data`` to the virtual address ``addr``. :param int addr: virtual address to write to. :param bytes data: data to be inserted at addr. :return: number of bytes inserted to virtual address ``addr`` :rtype: int :Example: >>> bv.insert(0,"BBBB") 4
(self, addr: int, data: bytes)
| 4525 | return core.BNWriteViewBuffer(self.handle, addr, buf.handle) |
| 4526 | |
| 4527 | def insert(self, addr: int, data: bytes) -> int: |
| 4528 | """ |
| 4529 | ``insert`` inserts the bytes in ``data`` to the virtual address ``addr``. |
| 4530 | |
| 4531 | :param int addr: virtual address to write to. |
| 4532 | :param bytes data: data to be inserted at addr. |
| 4533 | :return: number of bytes inserted to virtual address ``addr`` |
| 4534 | :rtype: int |
| 4535 | :Example: |
| 4536 | |
| 4537 | >>> bv.insert(0,"BBBB") |
| 4538 | 4 |
| 4539 | >>> bv.read(0,8) |
| 4540 | 'BBBBAAAA' |
| 4541 | """ |
| 4542 | if not (isinstance(data, bytes) or isinstance(data, bytearray) or isinstance(data, str)): |
| 4543 | raise TypeError("Must be bytes, bytearray, or str") |
| 4544 | else: |
| 4545 | buf = databuffer.DataBuffer(data) |
| 4546 | return core.BNInsertViewBuffer(self.handle, addr, buf.handle) |
| 4547 | |
| 4548 | def remove(self, addr: int, length: int) -> int: |
| 4549 | """ |