Concatenating byte arrays in C #

I have gzipped data that is stored in a DB. Is there a way to concatenate to say 50 separate gzipped data into one gzipped output, which can be uncompressed? The result should be the same as unpacking 50 elements, merging them, and then gzipping them.

I would like to avoid the decompression phase. Is there also a performance advantage for merging already gzipped data instead of a gzipping byte array?

+1
source share
3 answers

Yes, you can concatenate gzip streams, which when unpacked give you the same thing as if you combined uncompressed data and immediately pinned it. In particular:

gzip a
gzip b
cat a.gz b.gz > c.gz
gunzip c.gz

will provide you with the same cas:

cat a b > c

gzipping , 50 , . 10 K. , .

GZIPStream . DotNetZip.

+1

, , zipping . , , , .

+2

GZip , moreso gzip , gzip-, ... gzips .net 4.5

, , gzip, .. BGZF " GNU Zip"? .

, gzip , (gzip ).

DotNetZip, .

GZipStream , System.IO.BinaryWriter System.IO.BinaryReader, , . DotNetZip ! .

P.S. GZipStream 8 .Net 4, , . GZipStream 4 .Net 3.5

0
source

All Articles