Example #1
0
        // close BAM file
        public override void Close()
        {
            if (!IsOpen)
            {
                return;
            }
            IsOpen = false;

            _header = "";
            _reader.Dispose();        //.net core changes
            BgzfFileStream.Dispose(); //.net core changes
        }
Example #2
0
        // close Bgzipped file
        public override void Close()
        {
            if (!IsOpen)
            {
                return;
            }
            IsOpen = false;

            // flush the current BGZF block
            FlushBlock();

            if (_compressQueue != null)
            {
                // Signal that we're not going to add any more data to the queue.
                _compressQueue.CompleteAdding();

                // Wait for our compression threads to finish.
                int numCompressionThreads = _compressionThreads.Length;
                for (int i = 0; i < numCompressionThreads; ++i)
                {
                    _compressionThreads[i].Join();
                }

                // Signal to the writing thread that compression is complete.
                _writeQueue.CompleteAdding();

                // Wait for the writing thread to finish.
                _writingThread.Join();
            }

            // write an empty block (as EOF marker)
            FlushSingleBlock();

            //_writer.Close(); not supported with .net core
            //BgzfFileStream.Close();not supported with .net core
            _writer.Dispose();
            BgzfFileStream.Dispose();
        }