r""" ``read`` returns ``length`` bytes read from the current offset, adding ``length`` to offset. :param int length: number of bytes to read. :param int address: offset to set the internal offset before reading :return: ``length`` bytes from current offset :rtype: str, or None on failure
(self, length: int, address: Optional[int] = None)
| 10206 | return core.BNIsEndOfFile(self._handle) |
| 10207 | |
| 10208 | def read(self, length: int, address: Optional[int] = None) -> Optional[bytes]: |
| 10209 | r""" |
| 10210 | ``read`` returns ``length`` bytes read from the current offset, adding ``length`` to offset. |
| 10211 | |
| 10212 | :param int length: number of bytes to read. |
| 10213 | :param int address: offset to set the internal offset before reading |
| 10214 | :return: ``length`` bytes from current offset |
| 10215 | :rtype: str, or None on failure |
| 10216 | :Example: |
| 10217 | |
| 10218 | >>> br.read(8) |
| 10219 | '\xcf\xfa\xed\xfe\x07\x00\x00\x01' |
| 10220 | >>> |
| 10221 | """ |
| 10222 | if address is not None: |
| 10223 | self.seek(address) |
| 10224 | |
| 10225 | dest = ctypes.create_string_buffer(length) |
| 10226 | if not core.BNReadData(self._handle, dest, length): |
| 10227 | return None |
| 10228 | return dest.raw |
| 10229 | |
| 10230 | def read8(self, address: Optional[int] = None) -> Optional[int]: |
| 10231 | """ |