OpenHome.Git.Pack.Inflate C# (CSharp) Method

Inflate() private static method

private static Inflate ( BinaryReader aReader, long aLength ) : byte[]
aReader System.IO.BinaryReader
aLength long
return byte[]
        private static byte[] Inflate(BinaryReader aReader, long aLength)
        {
            Stream raw = aReader.BaseStream;

            Inflater inflater = new Inflater();

            InflaterInputStream stream = new InflaterInputStream(raw, inflater);

            long position = raw.Position;

            byte[] bytes = new byte[aLength];

            stream.Read(bytes, 0, (int)aLength);

            raw.Position = position + inflater.TotalIn + 4; // don't know why we add 4 but it works

            return (bytes);
        }