pub struct LzssDecoder { /* private fields */ }Expand description
LZSS sliding window decoder.
Implementations§
Source§impl LzssDecoder
impl LzssDecoder
Sourcepub fn new(window_size: usize) -> Self
pub fn new(window_size: usize) -> Self
Create a new LZSS decoder with the specified window size.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the decoder for reuse, avoiding reallocation. Note: Window contents are NOT cleared - we only read after writing.
Sourcepub fn enable_output(&mut self, capacity: usize)
pub fn enable_output(&mut self, capacity: usize)
Enable output accumulation for extracting files larger than window.
Sourcepub fn write_literal(&mut self, byte: u8)
pub fn write_literal(&mut self, byte: u8)
Write a literal byte to the window.
Sourcepub fn flush_to_output(&mut self, up_to: u64)
pub fn flush_to_output(&mut self, up_to: u64)
Flush data from window to output, up to the given absolute position. This is called after filters have been applied.
Sourcepub fn window_mut(&mut self) -> &mut [u8] ⓘ
pub fn window_mut(&mut self) -> &mut [u8] ⓘ
Get mutable access to the window for filter execution.
Sourcepub fn window_mask(&self) -> u32
pub fn window_mask(&self) -> u32
Get the window mask (for filter positioning).
Sourcepub fn flushed_pos(&self) -> u64
pub fn flushed_pos(&self) -> u64
Get how much has been flushed to output.
Sourcepub fn write_filtered_to_output(&mut self, data: &[u8], position: u64)
pub fn write_filtered_to_output(&mut self, data: &[u8], position: u64)
Write filtered data directly to output, bypassing the window. This is used for VM filter output which should NOT modify the window.
Sourcepub fn copy_match(&mut self, distance: u32, length: u32) -> Result<()>
pub fn copy_match(&mut self, distance: u32, length: u32) -> Result<()>
Copy bytes from a previous position in the window. Optimized for both overlapping and non-overlapping copies.
Sourcepub fn total_written(&self) -> u64
pub fn total_written(&self) -> u64
Get total bytes written.
Sourcepub fn get_output(&self, start: u64, len: usize) -> Vec<u8> ⓘ
pub fn get_output(&self, start: u64, len: usize) -> Vec<u8> ⓘ
Get a byte at the specified offset from current position (going back). Call this after decompression to get the output.
Sourcepub fn take_output(&mut self) -> Vec<u8> ⓘ
pub fn take_output(&mut self) -> Vec<u8> ⓘ
Take ownership of the accumulated output buffer. More efficient than get_output() when you need all output.
Sourcepub fn output_mut(&mut self) -> &mut [u8] ⓘ
pub fn output_mut(&mut self) -> &mut [u8] ⓘ
Get mutable access to the output buffer for filter execution.