Seeking on gzip streams?

Posted on 2006-10-13 (金) at 12:00 am

Posted in: Hacking

Dear Lazyweb,

do you know anything that implements seeking on gzip/zlib streams?

Seeking forward is easily done by reading the data up to the requested position, which isn't nice, but works well. Seeking backwards may be implemented by something like this:

inflateEnd (&stream);
fseek (input, 0, SEEK_SET);
inflateInit (&stream);
/* read up to the requested position */

This will be terribly slow for some cases, but well..

I'm just wondering how seeking with SEEK_END could be implemented without inflating the whole stream at first.




Navigation

Categories

Tags

Login