4 namespace ByteFX.Data.Common
\r
7 /// Summary description for Inflater.
\r
9 public class Inflater
\r
11 private BitStream _input;
\r
17 public void SetInput(byte[] input, int offset, int len)
\r
19 _input = new BitStream(input, offset, len);
\r
22 public void Inflate(byte[] output, int offset, int size)
\r
24 byte cmf = (byte)_input.GetBits(8);
\r
25 byte flag = (byte)_input.GetBits(8);
\r
27 if ((cmf & 0x0f) != 8)
\r
28 throw new Exception("Only deflate format data is supported");
\r
30 if (((cmf*256+flag) % 31) != 0)
\r
31 throw new Exception("Data is not in proper deflate format");
\r