System.util.zlib.ZDeflaterOutputStream.Write C# (CSharp) Method

Write() public method

public Write ( byte b, int off, int len ) : void
b byte
off int
len int
return void
        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(flushLevel);
                if(err!=JZlib.Z_OK)
                    throw new IOException("deflating: "+z.msg);
                if (z.avail_out < BUFSIZE)
                    outp.Write(buf, 0, BUFSIZE-z.avail_out);
            }
            while(z.avail_in>0 || z.avail_out==0);
        }

Usage Example

Esempio n. 1
0
 virtual public void WriteData(byte[] data, int stride) {
     MemoryStream stream = new MemoryStream();
     ZDeflaterOutputStream zip = new ZDeflaterOutputStream(stream, 5);
     int k;
     for (k = 0; k < data.Length - stride; k += stride) {
         zip.WriteByte(0);
         zip.Write(data, k, stride);
     }
     int remaining = data.Length - k;
     if (remaining > 0){
         zip.WriteByte(0);
         zip.Write(data, k, remaining);
     }
     zip.Close();
     WriteChunk(IDAT, stream.ToArray());
 }
All Usage Examples Of System.util.zlib.ZDeflaterOutputStream::Write