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 aBufReader<File>
from which to read the data.file_entry
- A reference to theModuleFileEntry
containing metadata about the file.file_offset
- The offset in the file where the data block starts.data
- A mutable reference to theVec<u8>
where the (decompressed) data will be stored.
§Errors
- If the reader fails to read the exact number of bytes
ReadError
- If the decompression operation fails
Error::DecompressionError
§Safety
- This function can be unsafe because it can call the
decompress
function, which is unsafe.