Dispose() 보호된 메소드

Dispose the stream.

This may or may not result in a Close() call on the captive stream. See the constructors that have a leaveOpen parameter for more information.

This method may be invoked in two distinct scenarios. If disposing == true, the method has been called directly or indirectly by a user's code, for example via the public Dispose() method. In this case, both managed and unmanaged resources can be referenced and disposed. If disposing == false, the method has been called by the runtime from inside the object finalizer and this method should not reference other objects; in that case only unmanaged resources must be referenced or disposed.

protected Dispose ( bool disposing ) : void
disposing bool /// indicates whether the Dispose method was invoked by user code. ///
리턴 void
예제 #1
0
        private byte[] InternalExtract()
        {
            _stream.Position = _manifest.Offset;

            var sizeBytes = new byte[4];
            _stream.Read(sizeBytes, 0, 4);

            int uncompressedSize = BitConverter.ToInt32(sizeBytes, 0);
            if (uncompressedSize <= 0)
            {
                return new byte[0];
            }

            _stream.Position += 4;

            var buffer = new byte[_manifest.UncompressedSize];

            var zlibStream = new ZlibStream(_stream, CompressionMode.Decompress, true);

            zlibStream.Read(buffer, 0, buffer.Length);

            zlibStream.Close();
            zlibStream.Dispose();

            return buffer;
        }