Beispiel #1
0
        public void Dispose()
        {
            _returnBuffer.Dispose();
            if (Used == 0)
            {
                return;
            }

            _stream.Write(_buffer.Buffer.Array, _buffer.Buffer.Offset, Used);
            Used = 0;
        }
 public virtual void Dispose()
 {
     try
     {
         Flush();
     }
     catch (ObjectDisposedException)
     {
         //we are disposing, so this exception doesn't matter
     }
     finally
     {
         _returnBuffer.Dispose();
         _context.ReturnMemory(_parserAuxiliarMemory);
     }
 }
 public virtual void Dispose()
 {
     try
     {
         Flush();
     }
     catch (ObjectDisposedException)
     {
         //we are disposing, so this exception doesn't matter
     }
     // TODO: remove when we update to .net core 3
     // https://github.com/dotnet/corefx/issues/36141
     catch (NotSupportedException e)
     {
         throw new IOException("The stream was closed by the peer.", e);
     }
     finally
     {
         _returnBuffer.Dispose();
         _context.ReturnMemory(_parserAuxiliarMemory);
     }
 }
Beispiel #4
0
 public void Dispose()
 {
     Flush();
     _returnBuffer.Dispose();
 }