MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / insert

Method insert

python/binaryview.py:4527–4546  ·  view source on GitHub ↗

``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)

Source from the content-addressed store, hash-verified

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 """

Callers 1

__setitem__Method · 0.95

Calls 1

DataBufferMethod · 0.80

Tested by

no test coverage detected