Argentini.Halide.H3Compress.Decompress C# (CSharp) Method

Decompress() public static method

GZip decompress a byte array.
public static Decompress ( byte gzipBuffer ) : byte[]
gzipBuffer byte Byte array to decompress.
return byte[]
        public static byte[] Decompress(byte[] gzipBuffer)
        {
            MemoryStream ms = new MemoryStream();
            int msgLength = BitConverter.ToInt32(gzipBuffer, 0);
            ms.Write(gzipBuffer, 4, gzipBuffer.Length - 4);

            byte[] buffer = new byte[msgLength];

            ms.Position = 0;
            GZipStream zip = new GZipStream(ms, CompressionMode.Decompress);
            zip.Read(buffer, 0, buffer.Length);

            return buffer;
        }