public virtual void Finish()
{
do
{
z.next_out = buf;
z.next_out_index = 0;
z.avail_out = buf.Length;
int err = compress
? z.deflate(JZlib.Z_FINISH)
: z.inflate(JZlib.Z_FINISH);
if (err != JZlib.Z_STREAM_END && err != JZlib.Z_OK)
{
// TODO
// throw new ZStreamException((compress?"de":"in")+"flating: "+z.msg);
throw new IOException((compress ? "de" : "in") + "flating: " + z.msg);
}
int count = buf.Length - z.avail_out;
if (count > 0)
{
output.Write(buf, 0, count);
}
}while (z.avail_in > 0 || z.avail_out == 0);
Flush();
}