Esempio n. 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void close() throws java.io.IOException
        public override void Close()
        {
            if (_closed)
            {
                /* This is just a defensive measure, for catching user errors from messing up the refCount. */
                throw new System.InvalidOperationException("Already closed");
            }

            _bufferedReader = null;
            _closed         = true;
            _segment.refCount().decrease();

            if (_hadError)
            {
                /* If the reader had en error, then it should be closed instead of returned to the pool. */
                _reader.Dispose();
            }
            else
            {
                _segment.positionCache().put(_position);
                _segment.readerPool().release(_reader);
            }
        }