Ejemplo n.º 1
0
 public void Dispose()
 {
     if (!_disposed)
     {
         RawStream.Close();
         _disposed = true;
     }
 }
Ejemplo n.º 2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_decStream != null)
         {
             _decStream.Close();
             _decStream = null;
         }
         if (_rawStream != null)
         {
             _rawStream.Close();
             _rawStream = null;
         }
     }
     _streamsBytes = null;
 }
Ejemplo n.º 3
0
        public override void Close()
        {
            if (!initdone)
            {
                DoInit(); // can happen if never called write
            }

            if (closed)
            {
                return;
            }

            closed = true;
            // sigh ... no only must I close the parent stream to force a flush, but I must save a reference
            // raw stream because (apparently) Close() sets it to null (shame on you, MS developers)
            if (deflateStream is object)
            {
                deflateStream.Close();
            }
            else
            {         // second hack: empty input?
                RawStream.WriteByte(3);
                RawStream.WriteByte(0);
            }
            // add crc
            var crcv = adler32.GetValue();

            RawStream.WriteByte((byte)((crcv >> 24) & 0xFF));
            RawStream.WriteByte((byte)((crcv >> 16) & 0xFF));
            RawStream.WriteByte((byte)((crcv >> 8) & 0xFF));
            RawStream.WriteByte((byte)(crcv & 0xFF));
            if (!LeaveOpen)
            {
                RawStream.Close();
            }
        }
Ejemplo n.º 4
0
 public override void Close()
 {
     base.Close();
     RawStream.Close();
 }