Skip to main content

read_data

Function read_data 

Source
pub fn read_data<R: Read + Seek>(
    reader: &mut R,
    volume: &ApfsVolume,
    inode: &Inode,
    block_size: usize,
) -> Result<Vec<u8>>
Expand description

Assemble a file’s full byte content, applying transparent decmpfs compression when the inode carries a com.apple.decmpfs xattr.

For an ordinary file, the data stream (inode.private_id) is read extent by extent (sparse holes zero-filled) and truncated to the inode’s logical size. For a transparently-compressed file, the decmpfs payload (inline in the xattr or in the com.apple.ResourceFork stream) is decoded via crate::compression — never the raw extent bytes.

§Errors

crate::ApfsError::Decmpfs if a decmpfs file’s payload cannot be decoded (a named codec/format error — never fabricated bytes); the structural errors of read_stream otherwise.