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

Class BinaryReader

binaryninjaapi.h:7408–7718  ·  view source on GitHub ↗

! BinaryReader is a convenience class for reading binary data \ingroup binaryview */

Source from the content-addressed store, hash-verified

7406 \ingroup binaryview
7407 */
7408 class BinaryReader
7409 {
7410 Ref<BinaryView> m_view;
7411 BNBinaryReader* m_stream;
7412
7413 public:
7414 /*! Create a BinaryReader instance given a BinaryView and endianness.
7415
7416 \param data BinaryView to read from
7417 \param endian Byte order to read with. One of LittleEndian, BigEndian
7418 */
7419 BinaryReader(BinaryView* data, BNEndianness endian = LittleEndian);
7420 ~BinaryReader();
7421
7422 /*! Get the endianness set for this reader.
7423
7424 \return The endianness set for this reader.
7425 */
7426 BNEndianness GetEndianness() const;
7427
7428 /*! Set the endianness for this reader
7429
7430 \param endian Byte order to read with. One of LittleEndian, BigEndian
7431 */
7432 void SetEndianness(BNEndianness endian);
7433
7434 /*! Read from the current cursor position into buffer `dest`
7435
7436 \throws ReadException
7437 \param dest Address to write the read bytes to
7438 \param len Number of bytes to write
7439 */
7440 void Read(void* dest, size_t len);
7441 /*! Read from the current cursor position into a DataBuffer
7442
7443 \throws ReadException
7444 \param len Number of bytes to read
7445 \return DataBuffer containing the bytes read
7446 */
7447 DataBuffer Read(size_t len);
7448 template <typename T>
7449 T Read();
7450 template <typename T>
7451 std::vector<T> ReadVector(size_t count);
7452
7453 /*! Read a string of fixed length from the current cursor position
7454
7455 \throws ReadException
7456 \param len Length of the string
7457 \return the string
7458 */
7459 std::string ReadString(size_t len);
7460
7461 /*! Read a null-terminated string from the current cursor position
7462
7463 \throws ReadException
7464 \param maxLength Maximum length of the string, default is no limit (-1)
7465 \return the string

Callers 3

FastGetImageCountMethod · 0.50
MachoObjCReaderMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected