Is there a character that never appears in the output of zlib.compress?
On 1/29/20 12:09 AM, Peng Yu wrote:
> I'd like to tell what part is zlib.compress data in an input stream.
> One way is to use some characters that never appear in zlib.compress
> output to denote the boundary. Are there such characters? Thanks.
A compression routine that avoid one byte value would be less efficient
at compression then one that uses all the values.
An alternative might be to precede the compressed data with a byte count
of how much data will follow (as well as whatever file code you use to
indicate that the next data IS compressed data.
A second method would be to take some byte value, (like FF) and where
ever it occurs in the compressed data, replace it with a doubled value
FF FF, and then add a single FF to the end.