Derek Atkins <warlord(_at_)MIT(_dot_)EDU> writes:
If only it were that easy. Consider what happens when someone says "You have
a
900K transfer buffer, stream data through it".
Do you mean you have 900K to transfer, or you have a buffer of 900K that you
can use to buffer something larger? In either case, I'd use the largest
buffer-size that fits (i.e. 512K in this case) and just eat the rest of the
buffer.
I don't control it, I'm told "Here's an xK buffer, employ it optimally" (as a
generalisation of that, any encoding method which forces a certain
implementation style to the exclusion of others is a bad idea. In this
instance it makes it extremely painful to use arbitrary-sized buffers).
it's what we came up with at the time.
There's a simple solution, which is to avoid it where possible (it's not
actually needed anywhere except maybe a few special-case situations, so you can
use definite-length encoding and 0xA3 in most cases).
Peter.