For Programmers: Free Programming Magazines  


Home > Archive > Compression > August 2005 > gzip uncompressed file size - confidence?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author gzip uncompressed file size - confidence?
saragwyn

2005-08-26, 6:55 pm

Hi all -

I was wondering whether there is a high degree of confidence that
reading the last four bytes of a gzip file will give me the unpacked
file size. How often have people experienced that there can be garbage
at the end of the file?

Thanks for your time
-Sara

aslanski2002@yahoo.com

2005-08-26, 9:55 pm


saragwyn yazdi:
> Hi all -
>
> I was wondering whether there is a high degree of confidence that
> reading the last four bytes of a gzip file will give me the unpacked
> file size. How often have people experienced that there can be garbage
> at the end of the file?


I use it all the time and so far I haven't had any problem.

>
> Thanks for your time
> -Sara


Mark Adler

2005-08-27, 3:55 am

saragwyn wrote:
> I was wondering whether there is a high degree of confidence that
> reading the last four bytes of a gzip file will give me the unpacked
> file size. How often have people experienced that there can be garbage
> at the end of the file?


There is almost never garbage at the end of a gzip file. However, it
is not uncommon for two or more gzip streams to be concatenated into
one file, since gunzip will decompress them all at once. In that case,
looking at the last four bytes will only give you the uncompressed size
(modulo 2^32) of the last of the gzip streams in the file.

And as I previously mentioned, even in the one stream per file case,
the degree of confidence depends on your certainty that the
uncompressed data is less than 4GB in length.

mark

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com