1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! Streaming utilities for stateful compression and decompression
//!
//! This module provides high-level streaming abstractions that maintain state
//! across multiple read/write operations, making it easy to work with
//! continuous data streams without loading entire files into memory.
pub use Compressor;
pub use Decompressor;
use ;
/// Create a stream reader that decompresses data on the fly
///
/// This function returns a `Read` implementer that automatically decompresses
/// data as it's read from the underlying source.
///
/// # Arguments
///
/// * `source` - Source data stream (must implement `Read`)
/// * `password` - Optional password for decryption
///
/// # Examples
///
/// ```rust
/// use mismall::stream::stream_reader;
/// use std::fs::File;
/// use std::io::Read;
///
/// // Note: This requires an existing compressed file
/// // let compressed_file = File::open("data.txt.small")?;
/// // let mut reader = stream_reader(compressed_file, None);
/// //
/// // let mut buffer = String::new();
/// // reader.read_to_string(&mut buffer)?;
/// // println!("Decompressed: {}", buffer);
/// # Ok::<(), Box<dyn std::error::Error>>(())
/// ```
/// Create a stream writer that compresses data on the fly
///
/// This function returns a `Write` implementer that automatically compresses
/// data as it's written, saving it to the underlying destination.
///
/// # Arguments
///
/// * `destination` - Destination stream (must implement `Write + Seek`)
/// * `filename` - Original filename for metadata
/// * `password` - Optional password for encryption
///
/// # Examples
///
/// ```rust
/// use mismall::stream::stream_writer;
/// use std::fs::File;
/// use std::io::Write;
///
/// // Note: This example shows the pattern
/// // let output_file = File::create("compressed.txt.small")?;
/// // let mut writer = stream_writer(output_file, "data.txt", None);
/// //
/// // writer.write_all(b"Hello, world!")?;
/// // writer.finish()?;
/// # Ok::<(), Box<dyn std::error::Error>>(())
/// ```