Copy a stream to an output.
*/
void fz_write_bits_sync(fz_context *ctx, fz_output *out);
+/**
+ Copy the stream contents to the output.
+*/
+void fz_write_stream(fz_context *ctx, fz_output *out, fz_stream *in);
+
/**
Our customised 'printf'-like string formatter.
Takes %c, %d, %s, %u, %x, %X as usual.
return;
fz_write_bits(ctx, out, 0, 8 - out->buffered);
}
+
+void
+fz_write_stream(fz_context *ctx, fz_output *out, fz_stream *in)
+{
+ size_t z;
+
+ while ((z = fz_available(ctx, in, 4096)) != 0)
+ {
+ fz_write_data(ctx, out, in->rp, z);
+ in->rp += z;
+ }
+}