From: stephan b. <st...@s1...> - 2005-01-01 19:55:31
|
On Saturday 01 January 2005 20:51, stephan beal wrote: > If we could come up with a factory-like approach which works for all > existing compression formats i think we could do it generically. > e.g., grab the first 6 bytes of any stream and pass them to to > Factory<IOStream>::create(). If it can load a factory with that > cookie, great. That means using binary strings as cookies, but this > doesn't inherently pose a problem for std::string keys. i hit send too soon... was does pose a problem is that we don't know how many bytes we need to read to check the cookie. For gz/bz we can do it in 2 bytes. pkzip might need more. Tar? XML? This requires logic-based factories, not key-based factories, but that requires, AFAICS, explicit knowledge of each type which can check this logic (as Christian points out). -- ----- st...@s1... http://s11n.net "...pleasure is a grace and is not obedient to the commands of the will." -- Alan W. Watts |