| >
| > | > |
| > |
| > | "Vadym Stetsyak" wrote:
| > |
| > | > Hello, MrNobody!
| > | >
| > | > M> I need to zip up an 8Gb file using C# - do you know of any
freeware
| > | > M> libraries
| > | > M> I can use to accomplish this? I guess it needs to be Zip64 to
support
| > | > M> such
| > | > M> file sizes.
| > | >
| > | > M> I tried something called sharpziplib but it doesn't support >2Gb
| > | > M> files -
| > | > M> they are working on it however but I cannot wait...
| > | >
| > | > Did you try GZipStream?
| > | > (
| >
http://msdn2.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx )
| > | > You must be using .NET 2.0 to work with it.
| > | >
| > | > --
| > | > Regards, Vadym Stetsyak
| > | > www:
http://vadmyst.blogspot
| > |
| > | Looks like GZip wouldn't work either, from the 'Remarks' :
| > |
| > | "This class cannot be used to compress files larger than 4 GB."
| >
| > Which is wrong too, actually the limit is 2GB, that's the max.size of an
| > object in .NET and the GZIP library needs the complete file to be read
in a
| > single byte array (which obviously is limitted to 2GB).
| >
|
| Why does GZIP require the entire file to be in memory first? It is a
sliding
| window algorithm similar to LZW. In any case, implementation is via a
| GZIPStream, which doesn't seem to require the entire file be loaded into
| memory first, so I believe 4GB is indeed the limit (which is the limit of
| addressable memory with a 32-bit pointer).
|
The limit is indeed 4GB, but it has nothing to do with the addressable
memory, this comes from the gzip RFC which requires the input file size to
be less than 4GB.
The input size is written to the compressed file as an unsigned int (module
2^32), the GZipStream implementation keeps an internal count of the number
of bytes read from the input stream and throws:
"System.IO.InvalidDataException: The gzip stream can't contain more than 4GB
data." when the number of bytes read exeeds 2^32.
Willy.