| 6 | #include "io/OutputStream.hxx" |
| 7 | |
| 8 | void |
| 9 | EncoderToOutputStream(OutputStream &os, Encoder &encoder) |
| 10 | { |
| 11 | while (true) { |
| 12 | /* read from the encoder */ |
| 13 | |
| 14 | std::byte buffer[32768]; |
| 15 | const auto r = encoder.Read(buffer); |
| 16 | if (r.empty()) |
| 17 | return; |
| 18 | |
| 19 | /* write everything to the stream */ |
| 20 | |
| 21 | os.Write(r); |
| 22 | } |
| 23 | } |