R
Robinson
I'm trying to work out how to decompress a GZipStream. I'm not sure how to
allocate the destination buffer, given that I cannot query the stream to
find out the total decompressed size of the item. A hack here
http://www.geekpedia.com/tutorial191_Unzipping-compressed-files-using-GZipStream.html
shows that you can get the last 4 bytes of the stream and convert it into an
integer "size". But this doesn't seem right to me. I could also allocate
one huge buffer, given I know my items won't be greater than 1mb in size
(for now), but this doesn't seem right either. The MSDN documentation
example shows that of course the decompress buffer is the same size as the
original compress buffer, because it uses the information from the original
file size to allocate it.
Is there a generic solution that might work using a memory stream?
Thanks
allocate the destination buffer, given that I cannot query the stream to
find out the total decompressed size of the item. A hack here
http://www.geekpedia.com/tutorial191_Unzipping-compressed-files-using-GZipStream.html
shows that you can get the last 4 bytes of the stream and convert it into an
integer "size". But this doesn't seem right to me. I could also allocate
one huge buffer, given I know my items won't be greater than 1mb in size
(for now), but this doesn't seem right either. The MSDN documentation
example shows that of course the decompress buffer is the same size as the
original compress buffer, because it uses the information from the original
file size to allocate it.
Is there a generic solution that might work using a memory stream?
Thanks