Function read_single_block

Source
fn read_single_block(
    reader: &mut BufReader<File>,
    file_entry: &ModuleFileEntry,
    file_offset: u64,
    data: &mut Vec<u8>,
) -> Result<()>
Expand description

Reads a single block of data from the file.

This function is used when the file entry contains only one block of data. It reads the entire block, and then either copies it directly to the output if it’s not compressed, or decompresses it if necessary.

§Arguments

  • reader - A mutable reference to a BufReader<File> from which to read the data.
  • file_entry - A reference to the ModuleFileEntry containing metadata about the file.
  • file_offset - The offset in the file where the data block starts.
  • data - A mutable reference to the Vec<u8> where the (decompressed) data will be stored.

§Errors

§Safety

  • This function can be unsafe because it can call the decompress function, which is unsafe.