BinaryRage.Functions.Compress.DecompressGZip C# (CSharp) 메소드

DecompressGZip() 공개 정적인 메소드

public static DecompressGZip ( byte gzip ) : byte[]
gzip byte
리턴 byte[]
        public static byte[] DecompressGZip(byte[] gzip)
        {
            if(gzip !=null)
            {
            using (GZipStream stream = new GZipStream(new MemoryStream(gzip), CompressionMode.Decompress))
            {
                const int size = 4096;
                byte[] buffer = new byte[size];
                using (MemoryStream memory = new MemoryStream())
                {
                    int count = 0;
                    do
                    {
                        count = stream.Read(buffer, 0, size);
                        if (count > 0)
                        {
                            memory.Write(buffer, 0, count);
                        }
                    }
                    while (count > 0);
                    return memory.ToArray();
                }
            }
            }

            return null;
        }