Zip Binary byte array - CSharp System.IO.Compression

CSharp examples for System.IO.Compression:Zip

Description

Zip Binary byte array

Demo Code


using System.Text;
using System.IO.Compression;
using System.IO;// ww w. ja  v a  2  s . com
using System.Collections.Generic;
using System;

public class Main{
        public static byte[] ZipBinary(byte[] rawSource)
        {
            memDestination = new MemoryStream();
            memSource = new MemoryStream(rawSource);
            gzipStream = new GZipStream(memDestination, CompressionMode.Compress);

            Streamer.CopyStream(memSource, gzipStream);

            gzipStream.Close();

            return memDestination.ToArray();
        }
}

Related Tutorials