The following table lists the BinaryFile object's member functions.
|BinaryFile.crc32(offset, length) returns the CRC-32 checksum of an address range length bytes long, starting at offset. This function computes a CRC-32 checksum on a block of data using the standard CRC-32 polynomial (0x04C11DB7) with an initial value of 0xFFFFFFFF. Note that this implementation doesn't reflect the input or the output and the result is inverted.
|BinaryFile.length() returns the length of the binary file in bytes.
|BinaryFile.load(path) loads binary file from path.
|BinaryFile.loadAppend(path) loads binary file from path and appends it to the binary image.
|BinaryFile.peekBytes(offset, length) returns byte array containing length bytes peeked from offset.
|BinaryFile.peekUint32(offset, littleEndian) returns a 32-bit word peeked from offset. The littleEndian argument specifies the endianness of the access, if true or undefined it will be little endian, otherwise it will be big endian.
|BinaryFile.pokeBytes(offset, byteArray) poke byte array byteArray to offset.
|BinaryFile.pokeUint32(offset, value, littleEndian) poke a value to 32-bit word located at offset. The littleEndian argument specifies the endianness of the access, if true or undefined it will be little endian, otherwise it will be big endian.
|BinaryFile.resize(length, fill) resizes the binary image to length bytes. If the operation extends the size, the binary image will be padded with bytes of value fill.
|BinaryFile.save(path) saves binary file to path.
|BinaryFile.saveRange(path, offset, length) saves part of the binary file to path. The offset argument specifies the byte offset to start from. The length argument specifies the maximum number of bytes that should be saved.