1) As to appending in deflate, its rather interesting,
I encountered an example of that in .docx of all things -
afair some config section is appended to the main .xml file there.
The deflate format includes "stored" blocks and the stream
is aligned to byte (its a decoding speed optimization likely).
So, compressed appending in deflate is implemented by adding
a zero-size stored block and then simply concatenating the streams.
2) To terminate a stream of unknown size the common method is
to use special signatures. For example, 0xFF is special like that in jpeg -
all FFs are masked in the data (converted to FF 00 afair), so its possible
to parse jpeg records without decoding the data and without any size fields.
Of course, a single byte is too redundant as such a marker - imho a 3-byte
marker is most reasonable, like what I used in lzmarec.
Its also possible to modify a rangecoder to avoid specific codes
(and thus not having to mask these in the data).
Some formats use longer dynamic markers (ie some hash is stored at block start
and also marks the block end), but imho its inefficient (but works around the