/// <summary>
        /// Returns an estimate of the number of bytes that can be read (or
        /// skipped over) from this input stream without blocking by the next
        /// invocation of a method for this input stream. The next invocation might be
        /// the same thread or another thread.  A single read or skip of this
        /// many bytes will not block, but may read or skip fewer bytes.
        /// <para>
        /// This method returns the sum of the number of bytes remaining to be read in
        /// the buffer (<code>count&nbsp;- pos</code>) and the result of calling the
        /// <seealso cref="java.io.FilterInputStream#in in"/>.available().
        ///
        /// </para>
        /// </summary>
        /// <returns>     an estimate of the number of bytes that can be read (or skipped
        ///             over) from this input stream without blocking. </returns>
        /// <exception cref="IOException">  if this input stream has been closed by
        ///                          invoking its <seealso cref="#close()"/> method,
        ///                          or an I/O error occurs. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public synchronized int available() throws IOException
        public override int Available()
        {
            lock (this)
            {
                int n     = Count - Pos;
                int avail = InIfOpen.Available();
                return(n > (Integer.MaxValue - avail) ? Integer.MaxValue : n + avail);
            }
        }