Deflate() private méthode

private Deflate ( System.IO.Compression.ZLibNative.FlushCode flushCode ) : System.IO.Compression.ZLibNative.ErrorCode
flushCode System.IO.Compression.ZLibNative.FlushCode
Résultat System.IO.Compression.ZLibNative.ErrorCode
Exemple #1
0
 // Close this stream.
 public override void Close()
 {
     if (stream != null)
     {
         if (deflater != null)
         {
             int temp;
             deflater.Finish();
             while (!deflater.IsFinished)
             {
                 temp = deflater.Deflate(buf, 0, buf.Length);
                 if (temp <= 0)
                 {
                     if (!deflater.IsFinished)
                     {
                         throw new IOException
                                   ("IO_Compress_Input");
                     }
                     break;
                 }
                 stream.Write(buf, 0, temp);
             }
         }
         if (!leaveOpen)
         {
             stream.Close();
         }
         stream   = null;
         inflater = null;
         deflater = null;
         buf      = null;
     }
 }
Exemple #2
0
        // Note: The .NET Framework SDK 2.0 version of this class does
        // not have BeginWrite and EndWrite for some inexplicable reason.

        // Close this stream.
        public override void Close()
        {
            if (stream != null)
            {
                if (deflater != null)
                {
                    int temp;
                    deflater.Finish();
                    while (!deflater.IsFinished)
                    {
                        temp = deflater.Deflate(buf, 0, buf.Length);
                        if (temp <= 0)
                        {
                            if (!deflater.IsFinished)
                            {
                                throw new IOException
                                          (S._("IO_Compress_Input"));
                            }
                            break;
                        }
                        stream.Write(buf, 0, temp);
                    }
                    byte[] footer = new byte [8];
                    temp      = (int)(crc32.Value);
                    footer[0] = (byte)temp;
                    footer[1] = (byte)(temp << 8);
                    footer[2] = (byte)(temp << 16);
                    footer[3] = (byte)(temp << 24);
                    temp      = deflater.TotalIn;
                    footer[4] = (byte)temp;
                    footer[5] = (byte)(temp << 8);
                    footer[6] = (byte)(temp << 16);
                    footer[7] = (byte)(temp << 24);
                    stream.Write(footer, 0, 8);
                }
                if (!leaveOpen)
                {
                    stream.Close();
                }
                stream   = null;
                inflater = null;
                deflater = null;
                buf      = null;
            }
        }