``write`` writes ``len(value)`` bytes to the internal offset, without regard to endianness. :param str bytes: bytes to be written at current offset :param int address: offset to set the internal offset before writing :param bool except_on_relocation: (default True) raise exception when wri
(self, value: bytes, address: Optional[int] = None, except_on_relocation=True)
| 10569 | core.BNSeekBinaryWriter(self._handle, value) |
| 10570 | |
| 10571 | def write(self, value: bytes, address: Optional[int] = None, except_on_relocation=True) -> bool: |
| 10572 | """ |
| 10573 | ``write`` writes ``len(value)`` bytes to the internal offset, without regard to endianness. |
| 10574 | |
| 10575 | :param str bytes: bytes to be written at current offset |
| 10576 | :param int address: offset to set the internal offset before writing |
| 10577 | :param bool except_on_relocation: (default True) raise exception when write overlaps a relocation |
| 10578 | :return: boolean True on success, False on failure. |
| 10579 | :rtype: bool |
| 10580 | :Example: |
| 10581 | |
| 10582 | >>> bw.write("AAAA") |
| 10583 | True |
| 10584 | >>> br.read(4) |
| 10585 | 'AAAA' |
| 10586 | >>> |
| 10587 | """ |
| 10588 | if address is not None: |
| 10589 | self.seek(address) |
| 10590 | |
| 10591 | if except_on_relocation and self._view.range_contains_relocation(self.offset, len(value)): |
| 10592 | raise RelocationWriteException("Attempting to write to a location which has a relocation") |
| 10593 | if isinstance(value, str): |
| 10594 | value = value.decode("utf-8") |
| 10595 | buf = ctypes.create_string_buffer(len(value)) |
| 10596 | ctypes.memmove(buf, value, len(value)) |
| 10597 | return core.BNWriteData(self._handle, buf, len(value)) |
| 10598 | |
| 10599 | def write8(self, value: int, address: Optional[int] = None, except_on_relocation=True) -> bool: |
| 10600 | """ |
no test coverage detected