UnZip Binary byte array - CSharp System.IO.Compression

CSharp examples for System.IO.Compression:Zip

Description

UnZip Binary byte array

Demo Code


using System.Text;
using System.IO.Compression;
using System.IO;/*  www .  j  a va  2  s.c  o  m*/
using System.Collections.Generic;
using System;

public class Main{
        public static byte[] UnZipBinary(byte[] compressedSource)
        {
            byte[] unpackedContent = new byte[compressedSource.Length * 20];
            memSource = new MemoryStream(compressedSource);

            gzipStream = new GZipStream(memSource, CompressionMode.Decompress);

            var readedBytes = gzipStream.Read(unpackedContent, 0, unpackedContent.Length);

            memDestination = new MemoryStream(unpackedContent, 0, readedBytes);

            return memDestination.ToArray();
        }
}

Related Tutorials