Inheritance: java.io.FilterReader
Example #1
0
        /// <summary>
        /// Releases the unmanaged resources used by this
        /// <see cref="T:System.IO.TextReader"/> and optionally
        /// releases the managed resources.
        /// </summary>
        /// <param name="disposing">
        /// Indicates whether disposale is occuring in the manageable code space.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                lock (this)
                {
                    try
                    {
                        if (m_in != null)
                        {
                            m_in.close();
                        }
                    }
                    catch (java.io.IOException ex)
                    {
                        throw new IOException(ex.toString(), ex);
                    }
                    finally
                    {
                        m_in         = null;
                        m_reader     = null;
                        m_lineReader = null;

                        base.Dispose(disposing);
                    }
                }
            }
            else
            {
                base.Dispose(disposing);
            }
        }
        public JavaReaderWrapper(java.io.Reader reader)
        {
            if (reader == null)
            {
                throw new NullReferenceException("reader");
            }

            try
            {
                m_reader = new PushbackReader(reader, 1);
                m_lineReader = new BufferedReader(m_reader);
            }
            catch (Exception e)
            {
                throw new IOException(e.ToString(), e);
            }

            m_in = reader;
        }
Example #3
0
        public JavaReaderWrapper(java.io.Reader reader)
        {
            if (reader == null)
            {
                throw new NullReferenceException("reader");
            }

            try
            {
                m_reader     = new PushbackReader(reader, 1);
                m_lineReader = new BufferedReader(m_reader);
            }
            catch (Exception e)
            {
                throw new IOException(e.ToString(), e);
            }

            m_in = reader;
        }
Example #4
0
        /// <summary>
        /// Reads the next character without changing the state of the reader
        /// or the character source. Returns the next available character without
        /// actually reading it from the input stream.
        /// </summary>
        /// <returns>
        /// The next character to be read, or -1 if no more characters are available
        /// or the stream does not support seeking.
        /// </returns>
        /// <exception cref="T:System.IO.IOException">
        /// When an I/O error occurs.</exception>
        /// <exception cref="T:System.ObjectDisposedException">
        /// When this <see cref="T:System.IO.TextReader"></see> is closed.
        /// </exception>
        public override int Peek()
        {
            try
            {
                lock (this)
                {
                    java.io.PushbackReader reader = Reader;

                    int peekValue = reader.read();

                    if (peekValue != -1)
                    {
                        reader.unread(peekValue);
                    }

                    return(peekValue);
                }
            }
            catch (java.io.IOException ex)
            {
                throw new IOException(ex.toString(), ex);
            }
        }
        /// <summary>
        /// Releases the unmanaged resources used by this
        /// <see cref="T:System.IO.TextReader"/> and optionally
        /// releases the managed resources.
        /// </summary>
        /// <param name="disposing">
        /// Indicates whether disposale is occuring in the manageable code space.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                lock (this)
                {
                    try
                    {
                        if (m_in != null)
                        {
                            m_in.close();
                        }
                    }
                    catch (java.io.IOException ex)
                    {
                        throw new IOException(ex.toString(), ex);
                    }
                    finally
                    {
                        m_in = null;
                        m_reader = null;
                        m_lineReader = null;

                        base.Dispose(disposing);
                    }
                }
            }
            else
            {
                base.Dispose(disposing);
            }
        }