Well, the whole point of indefinite-length encoding was to encode
something when you didn't know how long it was. For example:
run-some-command | pgp | some-other-command
In this case, you don't know how long the input is going to be,
therefore you want to use indefinite-length encoding. On the
other hand, if you can 'stat()' the source file ahead of time,
you should DEFINITELY use definite-length encoding.
-derek
pgut001(_at_)cs(_dot_)auckland(_dot_)ac(_dot_)nz (Peter Gutmann) writes:
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.
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord(_at_)MIT(_dot_)EDU PGP key available