Skip to main content

read_declared_size

Function read_declared_size 

Source
pub fn read_declared_size(
    entry: &mut impl Read,
    prefix: &[u8],
    size: u64,
) -> Result<Vec<u8>, DeclaredSizeFailure>
Expand description

Inflate exactly the size bytes an entry declares, after the prefix already read from it. One more byte is requested to confirm that the stream ends there, which is also when the reader checks the CRC. A stream longer or shorter than declared is refused, so the declared size the ratio and budget checks used is the size produced, and the buffer is reserved once at that size.