/// <summary>
        /// Reads uncompressed data into an array of bytes. If <code>len</code> is not
        /// zero, the method will block until some input can be decompressed; otherwise,
        /// no bytes are read and <code>0</code> is returned. </summary>
        /// <param name="b"> the buffer into which the data is read </param>
        /// <param name="off"> the start offset in the destination array <code>b</code> </param>
        /// <param name="len"> the maximum number of bytes read </param>
        /// <returns> the actual number of bytes read, or -1 if the end of the
        ///         compressed input is reached or a preset dictionary is needed </returns>
        /// <exception cref="NullPointerException"> If <code>b</code> is <code>null</code>. </exception>
        /// <exception cref="IndexOutOfBoundsException"> If <code>off</code> is negative,
        /// <code>len</code> is negative, or <code>len</code> is greater than
        /// <code>b.length - off</code> </exception>
        /// <exception cref="ZipException"> if a ZIP format error has occurred </exception>
        /// <exception cref="IOException"> if an I/O error has occurred </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public int read(byte[] b, int off, int len) throws java.io.IOException
        public override int Read(sbyte[] b, int off, int len)
        {
            EnsureOpen();
            if (b == null)
            {
                throw new NullPointerException();
            }
            else if (off < 0 || len < 0 || len > b.Length - off)
            {
                throw new IndexOutOfBoundsException();
            }
            else if (len == 0)
            {
                return(0);
            }
            try
            {
                int n;
                while ((n = Inf.Inflate(b, off, len)) == 0)
                {
                    if (Inf.Finished() || Inf.NeedsDictionary())
                    {
                        ReachEOF = true;
                        return(-1);
                    }
                    if (Inf.NeedsInput())
                    {
                        Fill();
                    }
                }
                return(n);
            }
            catch (DataFormatException e)
            {
                String s = e.Message;
                throw new ZipException(s != null ? s : "Invalid ZLIB data format");
            }
        }