Ejemplo n.º 1
0
        public override void Write(byte[] b, int off, int len)
        {
            if (len == 0)
            {
                return;
            }
            int err;

            z.next_in       = b;
            z.next_in_index = off;
            z.avail_in      = len;
            do
            {
                z.next_out       = buf;
                z.next_out_index = 0;
                z.avail_out      = BUFSIZE;
                err = z.deflate(flush);
                if (err != Zlib.Z_OK)
                {
                    throw new IOException("deflating: " + z.msg);
                }
                outp.Write(buf, 0, BUFSIZE - z.avail_out);
            }while(z.avail_in > 0 || z.avail_out == 0);
        }