pub struct LoadFileDataBlock<'a> { /* private fields */ }Expand description
Streaming Load File Data Block. Stateful pull reader: each call to
Self::next_block writes the next chunk into the caller’s buffer, so the
whole block never resides in RAM at once.
Implementations§
Source§impl LoadFileDataBlock<'_>
impl LoadFileDataBlock<'_>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Total LFDB byte length (sum of the §C.2-ordered components, decompressed).
Needed for the 'C4' tag length and to derive block_count.
Total framed LFDB byte length streamed to LOAD: the 'C4' tag+length
header plus the §C.2-ordered component content. This is what the LOAD
loop counts for last-block detection and block_count.
Sourcepub fn content_len(&self) -> usize
pub fn content_len(&self) -> usize
Content length only — the value of the 'C4' TLV (sum of the §C.2
components, decompressed), excluding the header. This is the length
encoded in the 'C4' header and the input over which a Load File Data
Block Hash (Lh) would be computed (GPCS v2.3.1 §11.6.2.3) — not the
framed stream.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
true if there is no component content (degenerate / malformed CAP).
Sourcepub fn next_block(
&mut self,
infl: &mut InflateCtx,
out: &mut [u8],
) -> Result<usize, CapError>
pub fn next_block( &mut self, infl: &mut InflateCtx, out: &mut [u8], ) -> Result<usize, CapError>
Write the next LFDB chunk into out (should be LOAD_BLOCK_DATA long)
and return the byte count written. Returns Ok(0) once the block is
exhausted. STORED components are copied from the borrowed input; DEFLATE
components are inflated through infl (the 32 KiB window doubles as the
wrapping dictionary). A chunk may straddle component boundaries (the LFDB
is the concatenation in GPCS §C.2 order), so bytes are assembled into
out.
§Errors
Returns CapError::Inflate if a DEFLATE component cannot be
decompressed (corrupt stream, or the input/window bound was exceeded).