public void readIntoBufferWithOffsetAfterDispose()
        {
            JavaInputStreamAdapter testSubject = NewTestSubject("asdf", Encoding.ASCII);

            testSubject.Dispose();

            byte[] buff = new byte[2];

            try
            {
                testSubject.read(buff, 1, 2);
            }
            catch (Exception ex)
            {
                java.io.IOException ioe = ex as java.io.IOException;

                if (ioe != null)
                {
                    System.Exception cause = ioe.getCause();
                    Assert.IsNotNull(cause);
                    Assert.IsInstanceOfType(typeof(System.ObjectDisposedException), cause);
                }

                throw;
            }
        }
Пример #2
0
        public static java.lang.Exception ToJavaException(this Exception exception)
        {
            java.lang.Exception je;

            if (exception is IOException)
            {
                je = new java.io.IOException();
            }
            else if (exception is EndOfStreamException)
            {
                je = new java.io.EOFException();
            }
            else if (exception is ArgumentException)
            {
                je = new java.lang.IllegalArgumentException();
            }
            else if (exception is UnauthorizedAccessException)
            {
                je = new java.lang.IllegalThreadStateException();
            }
            else if (exception is FormatException)
            {
                je = new java.lang.NumberFormatException();
            }
            else if (exception is NullReferenceException)
            {
                je = new java.lang.NullPointerException();
            }
            else if (exception is ArithmeticException)
            {
                je = new java.lang.ArithmeticException();
            }
            else if (exception is IndexOutOfRangeException)
            {
                je = new java.lang.ArrayIndexOutOfBoundsException();
            }
            else if (exception is InvalidCastException)
            {
                je = new java.lang.ClassCastException();
            }
            else
            {
                je = new java.lang.RuntimeException();
            }

            java.lang.String message = new java.lang.String();
            message.@this(new org.xmlvm._nArrayAdapter<char>(exception.ToString().ToCharArray()));
            je.@this(message);

            // TODO strack trace
            // TODO cause

            return je;
        }
Пример #3
0
        /// <summary>
        /// Flushes this output stream and forces any buffered output bytes
        /// to be written out.
        /// </summary>
        /// <exception cref="java.io.IOException">
        /// If an I/O error occurs.
        /// </exception>
        public override void flush()
        {
            try
            {
                m_stream.Flush();
            }
            catch (Exception ex)
            {
                IOException ioe = new IOException(ex.Message);

                ioe.initCause(ex);

                throw ioe;
            }
        }
Пример #4
0
        /// <summary>
        /// Writes the specified byte to this output stream.
        /// </summary>
        /// <param name="b">The <c>byte</c>.</param>
        /// <remarks>
        /// The general contract for <c>write</c> is that one
        /// byte is written  to the output stream. The byte to be
        /// written is the eight low-order bits of the argument
        /// <c>b</c>. The 24 high-order bits of <c>b</c>
        /// are ignored.
        /// </remarks>
        /// <exception cref="Exception">
        /// If an I/O error occurs. In particular, an
        /// <code>IOException</code> may be thrown if the
        /// output stream has been closed.
        /// </exception>
        public override void write(int b)
        {
            try
            {
                m_stream.WriteByte((byte)(b & 0xff));
            }
            catch (Exception ex)
            {
                IOException ioe = new IOException(ex.Message);

                ioe.initCause(ex);

                throw ioe;
            }
        }
Пример #5
0
        /// <summary>
        /// Writes <c>length</c> bytes from the specified byte array
        /// starting at <c>offset</c> to this output stream.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <param name="offset">The offset.</param>
        /// <param name="length">The length.</param>
        /// <remarks>
        /// The general contract is that some of the bytes in the array
        /// <code>buffer</code> are written to the output stream in order;
        /// element <code>buffer[offset]</code> is the first byte written
        /// and <code>buffer[offset+length-1]</code> is the last byte written
        /// by this operation.
        /// </remarks>
        /// <exception cref="java.io.IOException">
        /// If an I/O error occurs. In particular, an exception is thrown
        /// if the output stream is closed.
        /// </exception>
        public override void write(byte[] buffer, int offset, int length)
        {
            try
            {
                m_stream.Write(buffer, offset, length);
            }
            catch (Exception ex)
            {
                IOException ioe = new IOException(ex.Message);

                ioe.initCause(ex);

                throw ioe;
            }
        }
Пример #6
0
        /// <summary>
        /// Reads the next byte of data from this input stream.
        /// </summary>
        /// <remarks>
        /// The byte value is returned as an <c>int</c> in
        /// the range <c>0</c> to <c>255</c>. If no byte
        /// is available because the end of the stream has been reached,
        /// the value <c>-1</c> is returned. This method blocks
        /// until input data is available, the end of the stream is
        /// detected, or an exception is thrown.
        /// </remarks>
        /// <returns>
        /// The next byte of data, or <c>-1</c> if the end of the
        /// stream is reached.
        /// </returns>
        /// <exception cref="java.io.IOException">
        /// if an I/O error occurs.
        /// </exception>
        public override int read()
        {
            try
            {
                return(m_stream.ReadByte());
            }
            catch (Exception ex)
            {
                IOException ioe = new IOException(ex.Message);

                ioe.initCause(ex);

                throw ioe;
            }
        }
Пример #7
0
        /// <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.
        /// </summary>
        /// <remarks>
        /// <para> Note that while some implementations of {@code InputStream} will return
        /// the total number of bytes in the stream, many will not.  It is
        /// never correct to use the return value of this method to allocate
        /// a buffer intended to hold all data in this stream.
        /// </para>
        /// <para> A subclass' implementation of this method may choose to throw a
        /// java.io.IOException if this input stream has been closed by
        /// invoking the close() method.
        /// </para>
        /// <para> The <c>available</c> method of the java.io.InputStream class always
        /// returns {@code 0}.
        /// </para>
        /// <para> This method should be overridden by subclasses.
        /// </para>
        /// </remarks>
        /// <returns>
        /// an estimate of the number of bytes that can be read (or skipped
        /// over) from this input stream without blocking or {@code 0} when
        /// it reaches the end of the input stream.
        /// </returns>
        /// <exception cref="java.io.IOException">if an I/O error occurs.</exception>
        public override int available()
        {
            try
            {
                checked
                {
                    return((m_stream.CanRead && m_stream.CanSeek)
                        ? (int)(m_stream.Length - m_stream.Position)
                        : base.available());
                }
            }
            catch (Exception ex)
            {
                IOException ioe = new IOException(ex.Message);

                ioe.initCause(ex);

                throw ioe;
            }
        }
Пример #8
0
        /// <summary>
        /// Reads up to <c>length</c> bytes of data from the input/ stream
        /// into an array of bytes.
        /// </summary>
        /// <remarks>
        /// <para>
        /// An attempt is made to read as many as <c>length</c> bytes, but
        /// a smaller number may be read. The number of bytes actually
        /// read is returned as an integer.
        /// </para>
        /// <para>
        /// This method blocks until input data is available, end of file
        /// is detected, or an exception is thrown.
        /// </para>
        /// <para>
        /// If <c>length</c> is zero, then no bytes are read and <c>0</c> is
        /// returned; otherwise, there is an attempt to read at least one byte.
        /// If no byte is available because the stream is at end of file, the
        /// value <c>-1</c> is returned; otherwise, at least one byte is read
        /// and stored into <c>buffer</c>.
        /// </para>
        /// <para>
        /// The first byte read is stored into element <c>buffer[offset]</c>,
        /// the next one into <c>buffer[offset+1]</c>, and so on. The number
        /// of bytes read is, at most, equal to <c>length</c>. Let <i>k</i>
        /// be the number of bytes actually read; these bytes will be stored
        /// in elements <c>buffer[offset]</c> through <c>buffer[offset+</c>
        /// <i>k</i><c>-1]</c>, leaving elements <c>buffer[offset+</c><i>k</i>
        /// <c>]</c> through <c>buffer[offset+length-1]</c> unaffected.
        /// </para>
        /// <para>
        /// In every case, elements <c>buffer[0]</c> through
        /// <c>buffer[offset]</c> and elements <c>buffer[offset+length]</c>
        /// through <c>buffer[b.length-1]</c> are unaffected.
        /// </para>
        /// </remarks>
        /// <param name="buffer">
        /// The buffer into which the data is read.
        /// </param>
        /// <param name="offset">
        /// The start offset in array <c>buffer</c> at which the data
        /// is written.
        /// </param>
        /// <param name="length">
        /// The maximum number of bytes to read.
        /// </param>
        /// <returns>
        /// The total number of bytes read into the buffer, or <c>-1</c> if
        /// there is no more data because the end of the stream has been
        /// reached.
        /// </returns>
        /// <exception cref="java.io.IOException">
        /// If the first byte cannot be read for any reason other than end of
        /// file, or if the input stream has been closed, or if some other
        /// I/O error occurs.
        /// </exception>
        /// <exception cref="java.lang.NullPointerException">
        /// If <c>buffer</c> is <c>null</c>.
        /// </exception>
        /// <exception cref="java.lang.IndexOutOfBoundsException">
        /// If <c>offset</c> is negative,  <c>length</c> is negative,
        /// or <c>length</c> is greater than  <c>b.length - offset</c>.
        /// </exception>
        public override int read(
            byte[] buffer,
            int offset,
            int length)
        {
            try
            {
                int bytesRead = m_stream.Read(buffer, offset, length);

                return((bytesRead == 0)
                    ? -1
                    : bytesRead);
            }
            catch (Exception ex)
            {
                IOException ioe = new IOException(ex.Message);

                ioe.initCause(ex);

                throw ioe;
            }
        }
        public void skipAfterDispose()
        {
            JavaInputStreamAdapter testSubject = NewTestSubject("asdf", Encoding.ASCII);

            testSubject.Dispose();

            try
            {
                testSubject.skip(1);
            }
            catch (Exception ex)
            {
                java.io.IOException ioe = ex as java.io.IOException;

                if (ioe != null)
                {
                    System.Exception cause = ioe.getCause();
                    Assert.IsNotNull(cause);
                    Assert.IsInstanceOfType(typeof(System.ObjectDisposedException), cause);
                }

                throw;
            }
        }
        /// <summary>
        /// Closes this input stream and releases any system
        /// resources associated with it.
        /// </summary>
        /// <exception cref="Exception">
        /// If an I/O error occurs.
        /// </exception>
        public override void close()
        {
            try
            {
                m_stream.Close();
            }
            catch (Exception ex)
            {
                IOException ioe = new IOException(ex.Message);

                ioe.initCause(ex);

                throw ioe;
            }
        }
        /// <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.
        /// </summary>
        /// <remarks>
        /// <para> Note that while some implementations of {@code InputStream} will return
        /// the total number of bytes in the stream, many will not.  It is
        /// never correct to use the return value of this method to allocate
        /// a buffer intended to hold all data in this stream.
        /// </para>
        /// <para> A subclass' implementation of this method may choose to throw a
        /// java.io.IOException if this input stream has been closed by
        /// invoking the close() method.
        /// </para>
        /// <para> The <c>available</c> method of the java.io.InputStream class always
        /// returns {@code 0}.
        /// </para>
        /// <para> This method should be overridden by subclasses.
        /// </para>
        /// </remarks>
        /// <returns>
        /// an estimate of the number of bytes that can be read (or skipped
        /// over) from this input stream without blocking or {@code 0} when
        /// it reaches the end of the input stream.
        /// </returns>
        /// <exception cref="java.io.IOException">if an I/O error occurs.</exception>
        public override int available()
        {
            try
            {
                checked
                {
                    return (m_stream.CanRead && m_stream.CanSeek)
                        ? (int)(m_stream.Length - m_stream.Position)
                        : base.available();
                }
            }
            catch (Exception ex)
            {
                IOException ioe = new IOException(ex.Message);

                ioe.initCause(ex);

                throw ioe;
            }
        }
 protected sealed override SystemException CreateException(java.io.IOException e)
 {
     return(new OleDbException(e, (OleDbConnection)_command.Connection));
 }
        /// <summary>
        /// Writes <c>length</c> bytes from the specified byte array
        /// starting at <c>offset</c> to this output stream.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <param name="offset">The offset.</param>
        /// <param name="length">The length.</param>
        /// <remarks>
        /// The general contract is that some of the bytes in the array
        /// <code>buffer</code> are written to the output stream in order;
        /// element <code>buffer[offset]</code> is the first byte written
        /// and <code>buffer[offset+length-1]</code> is the last byte written
        /// by this operation.
        /// </remarks>
        /// <exception cref="java.io.IOException">
        /// If an I/O error occurs. In particular, an exception is thrown
        /// if the output stream is closed.
        /// </exception>
        public override void write(byte[] buffer, int offset, int length)
        {
            try
            {
                m_stream.Write(buffer, offset, length);
            }
            catch (Exception ex)
            {
                IOException ioe =  new IOException(ex.Message);

                ioe.initCause(ex);

                throw ioe;
            }
        }
        /// <summary>
        /// Writes the specified byte to this output stream.
        /// </summary>
        /// <param name="b">The <c>byte</c>.</param>
        /// <remarks>
        /// The general contract for <c>write</c> is that one
        /// byte is written  to the output stream. The byte to be
        /// written is the eight low-order bits of the argument
        /// <c>b</c>. The 24 high-order bits of <c>b</c>
        /// are ignored.
        /// </remarks>
        /// <exception cref="Exception">
        /// If an I/O error occurs. In particular, an
        /// <code>IOException</code> may be thrown if the
        /// output stream has been closed.
        /// </exception>
        public override void write(int b)
        {
            try
            {
                m_stream.WriteByte((byte)(b & 0xff));
            }
            catch (Exception ex)
            {
                IOException ioe = new IOException(ex.Message);

                ioe.initCause(ex);

                throw ioe;
            }
        }
Пример #15
0
        private void writeFieldValues(global::java.lang.Object n1, global::java.io.ObjectStreamClass n2)
        {
//XMLVM_BEGIN_WRAPPER[java.io.ObjectOutputStream: void writeFieldValues(java.lang.Object, java.io.ObjectStreamClass)]
            org.xmlvm._nElement _r0;
            _r0.i = 0;
            _r0.l = 0;
            _r0.f = 0;
            _r0.d = 0;
            global::System.Object _r0_o = null;
            org.xmlvm._nElement   _r1;
            _r1.i = 0;
            _r1.l = 0;
            _r1.f = 0;
            _r1.d = 0;
            global::System.Object _r1_o = null;
            org.xmlvm._nElement   _r2;
            _r2.i = 0;
            _r2.l = 0;
            _r2.f = 0;
            _r2.d = 0;
            global::System.Object _r2_o = null;
            org.xmlvm._nElement   _r3;
            _r3.i = 0;
            _r3.l = 0;
            _r3.f = 0;
            _r3.d = 0;
            global::System.Object _r3_o = null;
            org.xmlvm._nElement   _r4;
            _r4.i = 0;
            _r4.l = 0;
            _r4.f = 0;
            _r4.d = 0;
            global::System.Object _r4_o = null;
            org.xmlvm._nElement   _r5;
            _r5.i = 0;
            _r5.l = 0;
            _r5.f = 0;
            _r5.d = 0;
            global::System.Object _r5_o = null;
            org.xmlvm._nElement   _r6;
            _r6.i = 0;
            _r6.l = 0;
            _r6.f = 0;
            _r6.d = 0;
            global::System.Object _r6_o = null;
            org.xmlvm._nElement   _r7;
            _r7.i = 0;
            _r7.l = 0;
            _r7.f = 0;
            _r7.d = 0;
            global::System.Object _r7_o = null;
            org.xmlvm._nElement   _r8;
            _r8.i = 0;
            _r8.l = 0;
            _r8.f = 0;
            _r8.d = 0;
            global::System.Object _r8_o = null;
            org.xmlvm._nElement   _r9;
            _r9.i = 0;
            _r9.l = 0;
            _r9.f = 0;
            _r9.d = 0;
            global::System.Object _r9_o = null;
            org.xmlvm._nElement   _r10;
            _r10.i = 0;
            _r10.l = 0;
            _r10.f = 0;
            _r10.d = 0;
            global::System.Object        _r10_o = null;
            org.xmlvm._nExceptionAdapter _ex    = null;
            _r8_o  = this;
            _r9_o  = n1;
            _r10_o = n2;
            _r0_o  = ((java.io.ObjectStreamClass)_r10_o).fields();
            _r1_o  = ((java.io.ObjectStreamClass)_r10_o).forClass();
            _r2.i  = ((org.xmlvm._nIArray)_r0_o).Length;
            _r3.i  = 0;
            label10 :;
            if (_r3.i < _r2.i)
            {
                goto label13;
            }
            return;

            label13 :;
            _r4_o = ((org.xmlvm._nArrayAdapter <global::System.Object>)_r0_o)[_r3.i];
            try {
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
                _r5.l = ((java.io.ObjectStreamField)_r4_o).getFieldID((org.xmlvm.runtime.RedTypeMarker)_r5_o, (java.lang.Class)_r1_o);
                _r7.i = ((java.io.ObjectStreamField)_r4_o).isPrimitive() ? 1 : 0;
                if (_r7.i == 0)
                {
                    goto label159;
                }
                _r7.i = ((java.io.ObjectStreamField)_r4_o).getTypeCode();
                switch (_r7.i)
                {
                case 66: goto label61;

                case 67: goto label75;

                case 68: goto label87;

                case 70: goto label99;

                case 73: goto label111;

                case 74: goto label123;

                case 83: goto label135;

                case 90: goto label147;
                }
                _r0_o = new java.io.IOException();
                _r1_o = new java.lang.String();
                ((java.lang.String)_r1_o).@this(new org.xmlvm._nArrayAdapter <char>("luni.BF".ToCharArray()));
                _r2.i = ((java.io.ObjectStreamField)_r4_o).getTypeCode();
                _r1_o = [email protected]((java.lang.String)_r1_o, (char)_r2.i);
                ((java.io.IOException)_r0_o).@this((java.lang.String)_r1_o);
                throw new org.xmlvm._nExceptionAdapter((java.io.IOException)_r0_o);
            }
            catch (org.xmlvm._nExceptionAdapter ex) {
                global::System.Object _java_exception = ex.getJavaException();
                if (_java_exception is java.lang.NoSuchFieldError)
                {
                    _ex = ex;
                    goto label50;
                }
                throw ex;
            } // end catch
            label50 :;
            _r0_o = _ex.getJavaException();
            _ex   = null;
            _r0_o = new java.io.InvalidClassException();
            _r1_o = ((java.io.ObjectStreamClass)_r10_o).getName();
            ((java.io.InvalidClassException)_r0_o).@this((java.lang.String)_r1_o);
            throw new org.xmlvm._nExceptionAdapter((java.io.InvalidClassException)_r0_o);
            label61 :;
            try {
                _r4_o = ((java.io.ObjectOutputStream)_r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getByte
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getByte");
                ((java.io.DataOutputStream)_r4_o).writeByte((int)_r5.i);
            }
            catch (org.xmlvm._nExceptionAdapter ex) {
                global::System.Object _java_exception = ex.getJavaException();
                if (_java_exception is java.lang.NoSuchFieldError)
                {
                    _ex = ex;
                    goto label50;
                }
                throw ex;
            } // end catch
            label72 :;
            try {
                _r3.i = _r3.i + 1;
                goto label10;
            }
            catch (org.xmlvm._nExceptionAdapter ex) {
                global::System.Object _java_exception = ex.getJavaException();
                if (_java_exception is java.lang.NoSuchFieldError)
                {
                    _ex = ex;
                    goto label50;
                }
                throw ex;
            } // end catch
            label75 :;
            try {
                _r4_o = ((java.io.ObjectOutputStream)_r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getChar
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getChar");
                ((java.io.DataOutputStream)_r4_o).writeChar((int)_r5.i);
                goto label72;
            }
            catch (org.xmlvm._nExceptionAdapter ex) {
                global::System.Object _java_exception = ex.getJavaException();
                if (_java_exception is java.lang.NoSuchFieldError)
                {
                    _ex = ex;
                    goto label50;
                }
                throw ex;
            } // end catch
            label87 :;
            try {
                _r4_o = ((java.io.ObjectOutputStream)_r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getDouble
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getDouble");
                ((java.io.DataOutputStream)_r4_o).writeDouble((double)_r5.d);
                goto label72;
            }
            catch (org.xmlvm._nExceptionAdapter ex) {
                global::System.Object _java_exception = ex.getJavaException();
                if (_java_exception is java.lang.NoSuchFieldError)
                {
                    _ex = ex;
                    goto label50;
                }
                throw ex;
            } // end catch
            label99 :;
            try {
                _r4_o = ((java.io.ObjectOutputStream)_r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getFloat
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getFloat");
                ((java.io.DataOutputStream)_r4_o).writeFloat((float)_r5.f);
                goto label72;
            }
            catch (org.xmlvm._nExceptionAdapter ex) {
                global::System.Object _java_exception = ex.getJavaException();
                if (_java_exception is java.lang.NoSuchFieldError)
                {
                    _ex = ex;
                    goto label50;
                }
                throw ex;
            } // end catch
            label111 :;
            try {
                _r4_o = ((java.io.ObjectOutputStream)_r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getInt
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getInt");
                ((java.io.DataOutputStream)_r4_o).writeInt((int)_r5.i);
                goto label72;
            }
            catch (org.xmlvm._nExceptionAdapter ex) {
                global::System.Object _java_exception = ex.getJavaException();
                if (_java_exception is java.lang.NoSuchFieldError)
                {
                    _ex = ex;
                    goto label50;
                }
                throw ex;
            } // end catch
            label123 :;
            try {
                _r4_o = ((java.io.ObjectOutputStream)_r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getLong
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getLong");
                ((java.io.DataOutputStream)_r4_o).writeLong((long)_r5.l);
                goto label72;
            }
            catch (org.xmlvm._nExceptionAdapter ex) {
                global::System.Object _java_exception = ex.getJavaException();
                if (_java_exception is java.lang.NoSuchFieldError)
                {
                    _ex = ex;
                    goto label50;
                }
                throw ex;
            } // end catch
            label135 :;
            try {
                _r4_o = ((java.io.ObjectOutputStream)_r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getShort
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getShort");
                ((java.io.DataOutputStream)_r4_o).writeShort((int)_r5.i);
                goto label72;
            }
            catch (org.xmlvm._nExceptionAdapter ex) {
                global::System.Object _java_exception = ex.getJavaException();
                if (_java_exception is java.lang.NoSuchFieldError)
                {
                    _ex = ex;
                    goto label50;
                }
                throw ex;
            } // end catch
            label147 :;
            try {
                _r4_o = ((java.io.ObjectOutputStream)_r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getBoolean
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getBoolean");
                ((java.io.DataOutputStream)_r4_o).writeBoolean(0 != _r5.i);
                goto label72;
            }
            catch (org.xmlvm._nExceptionAdapter ex) {
                global::System.Object _java_exception = ex.getJavaException();
                if (_java_exception is java.lang.NoSuchFieldError)
                {
                    _ex = ex;
                    goto label50;
                }
                throw ex;
            } // end catch
            label159 :;
            try {
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getObject
                throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getObject");
                _r4.i = ((java.io.ObjectStreamField)_r4_o).isUnshared() ? 1 : 0;
                if (_r4.i == 0)
                {
                    goto label175;
                }
                ((java.io.ObjectOutputStream)_r8_o).writeUnshared((java.lang.Object)_r5_o);
                goto label72;
            }
            catch (org.xmlvm._nExceptionAdapter ex) {
                global::System.Object _java_exception = ex.getJavaException();
                if (_java_exception is java.lang.NoSuchFieldError)
                {
                    _ex = ex;
                    goto label50;
                }
                throw ex;
            } // end catch
            label175 :;
            try {
                ((java.io.ObjectOutputStream)_r8_o).writeObject((java.lang.Object)_r5_o);
            }
            catch (org.xmlvm._nExceptionAdapter ex) {
                global::System.Object _java_exception = ex.getJavaException();
                if (_java_exception is java.lang.NoSuchFieldError)
                {
                    _ex = ex;
                    goto label50;
                }
                throw ex;
            } // end catch
            goto label72;
            label180 :;
//XMLVM_END_WRAPPER[java.io.ObjectOutputStream: void writeFieldValues(java.lang.Object, java.io.ObjectStreamClass)]
        }
        /// <summary>
        /// Reads the next byte of data from this input stream. 
        /// </summary>
        /// <remarks>
        /// The byte value is returned as an <c>int</c> in
        /// the range <c>0</c> to <c>255</c>. If no byte
        /// is available because the end of the stream has been reached,
        /// the value <c>-1</c> is returned. This method blocks
        /// until input data is available, the end of the stream is
        /// detected, or an exception is thrown.
        /// </remarks>
        /// <returns>    
        /// The next byte of data, or <c>-1</c> if the end of the
        /// stream is reached.
        /// </returns>
        /// <exception cref="java.io.IOException">
        /// if an I/O error occurs.
        /// </exception>
        public override int read()
        {
            try
            {
                return m_stream.ReadByte();
            }
            catch (Exception ex)
            {
                IOException ioe = new IOException(ex.Message);

                ioe.initCause(ex);

                throw ioe;
            }
        }
        /// <summary>
        /// Reads up to <c>length</c> bytes of data from the input/ stream
        /// into an array of bytes.
        /// </summary>
        /// <remarks>
        /// <para>
        /// An attempt is made to read as many as <c>length</c> bytes, but
        /// a smaller number may be read. The number of bytes actually
        /// read is returned as an integer.
        /// </para>
        /// <para>
        /// This method blocks until input data is available, end of file
        /// is detected, or an exception is thrown.
        /// </para>
        /// <para>
        /// If <c>length</c> is zero, then no bytes are read and <c>0</c> is
        /// returned; otherwise, there is an attempt to read at least one byte.
        /// If no byte is available because the stream is at end of file, the
        /// value <c>-1</c> is returned; otherwise, at least one byte is read
        /// and stored into <c>buffer</c>.
        /// </para>
        /// <para>
        /// The first byte read is stored into element <c>buffer[offset]</c>,
        /// the next one into <c>buffer[offset+1]</c>, and so on. The number
        /// of bytes read is, at most, equal to <c>length</c>. Let <i>k</i>
        /// be the number of bytes actually read; these bytes will be stored
        /// in elements <c>buffer[offset]</c> through <c>buffer[offset+</c>
        /// <i>k</i><c>-1]</c>, leaving elements <c>buffer[offset+</c><i>k</i>
        /// <c>]</c> through <c>buffer[offset+length-1]</c> unaffected.
        /// </para>
        /// <para>
        /// In every case, elements <c>buffer[0]</c> through
        /// <c>buffer[offset]</c> and elements <c>buffer[offset+length]</c>
        /// through <c>buffer[b.length-1]</c> are unaffected.
        /// </para>
        /// </remarks>
        /// <param name="buffer">
        /// The buffer into which the data is read.
        /// </param>
        /// <param name="offset">
        /// The start offset in array <c>buffer</c> at which the data
        /// is written.
        /// </param>
        /// <param name="length">
        /// The maximum number of bytes to read.
        /// </param>
        /// <returns>
        /// The total number of bytes read into the buffer, or <c>-1</c> if
        /// there is no more data because the end of the stream has been
        /// reached.
        /// </returns>
        /// <exception cref="java.io.IOException">
        /// If the first byte cannot be read for any reason other than end of
        /// file, or if the input stream has been closed, or if some other
        /// I/O error occurs.
        /// </exception>
        /// <exception cref="java.lang.NullPointerException">
        /// If <c>buffer</c> is <c>null</c>.
        /// </exception>
        /// <exception cref="java.lang.IndexOutOfBoundsException">
        /// If <c>offset</c> is negative,  <c>length</c> is negative,
        /// or <c>length</c> is greater than  <c>b.length - offset</c>.
        /// </exception>
        public override int read(
            byte[] buffer,
            int offset,
            int length)
        {
            try
            {
                int bytesRead = m_stream.Read(buffer, offset, length);

                return (bytesRead == 0)
                    ? -1
                    : bytesRead;
            }
            catch (Exception ex)
            {
                IOException ioe = new IOException(ex.Message);

                ioe.initCause(ex);

                throw ioe;
            }
        }
Пример #18
0
private void writeFieldValues(global::java.lang.Object n1, global::java.io.ObjectStreamClass n2){
//XMLVM_BEGIN_WRAPPER[java.io.ObjectOutputStream: void writeFieldValues(java.lang.Object, java.io.ObjectStreamClass)]
    org.xmlvm._nElement _r0;
    _r0.i = 0;
    _r0.l = 0;
    _r0.f = 0;
    _r0.d = 0;
    global::System.Object _r0_o = null;
    org.xmlvm._nElement _r1;
    _r1.i = 0;
    _r1.l = 0;
    _r1.f = 0;
    _r1.d = 0;
    global::System.Object _r1_o = null;
    org.xmlvm._nElement _r2;
    _r2.i = 0;
    _r2.l = 0;
    _r2.f = 0;
    _r2.d = 0;
    org.xmlvm._nElement _r3;
    _r3.i = 0;
    _r3.l = 0;
    _r3.f = 0;
    _r3.d = 0;
    org.xmlvm._nElement _r4;
    _r4.i = 0;
    _r4.l = 0;
    _r4.f = 0;
    _r4.d = 0;
    global::System.Object _r4_o = null;
    org.xmlvm._nElement _r5;
    _r5.i = 0;
    _r5.l = 0;
    _r5.f = 0;
    _r5.d = 0;
    global::System.Object _r5_o = null;
    org.xmlvm._nElement _r6;
    _r6.i = 0;
    _r6.l = 0;
    _r6.f = 0;
    _r6.d = 0;
    org.xmlvm._nElement _r7;
    _r7.i = 0;
    _r7.l = 0;
    _r7.f = 0;
    _r7.d = 0;
    org.xmlvm._nElement _r8;
    _r8.i = 0;
    _r8.l = 0;
    _r8.f = 0;
    _r8.d = 0;
    global::System.Object _r8_o = null;
    org.xmlvm._nElement _r9;
    _r9.i = 0;
    _r9.l = 0;
    _r9.f = 0;
    _r9.d = 0;
    global::System.Object _r9_o = null;
    org.xmlvm._nElement _r10;
    _r10.i = 0;
    _r10.l = 0;
    _r10.f = 0;
    _r10.d = 0;
    global::System.Object _r10_o = null;
    org.xmlvm._nExceptionAdapter _ex = null;
    _r8_o = this;
    _r9_o = n1;
    _r10_o = n2;
    _r0_o = ((java.io.ObjectStreamClass) _r10_o).fields();
    _r1_o = ((java.io.ObjectStreamClass) _r10_o).forClass();
    _r2.i = ((org.xmlvm._nIArray) _r0_o).Length;
    _r3.i = 0;
    label10:;
    if (_r3.i < _r2.i) goto label13;
    return;
    label13:;
    _r4_o = ((org.xmlvm._nArrayAdapter<global::System.Object>) _r0_o)[_r3.i];
    try {
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
    _r5.l = ((java.io.ObjectStreamField) _r4_o).getFieldID((org.xmlvm.runtime.RedTypeMarker) _r5_o, (java.lang.Class) _r1_o);
    _r7.i = ((java.io.ObjectStreamField) _r4_o).isPrimitive() ? 1 : 0;
    if (_r7.i == 0) goto label159;
    _r7.i = ((java.io.ObjectStreamField) _r4_o).getTypeCode();
    switch (_r7.i) {
    case 66: goto label61;
    case 67: goto label75;
    case 68: goto label87;
    case 70: goto label99;
    case 73: goto label111;
    case 74: goto label123;
    case 83: goto label135;
    case 90: goto label147;
    }
    _r0_o = new java.io.IOException();
    _r1_o = new java.lang.String();
    ((java.lang.String)_r1_o).@this(new org.xmlvm._nArrayAdapter<char>("luni.BF".ToCharArray()));
    _r2.i = ((java.io.ObjectStreamField) _r4_o).getTypeCode();
    _r1_o = [email protected]((java.lang.String) _r1_o, (char) _r2.i);
    ((java.io.IOException) _r0_o).@this((java.lang.String) _r1_o);
    throw new org.xmlvm._nExceptionAdapter((java.io.IOException) _r0_o);
    }
    catch (org.xmlvm._nExceptionAdapter ex) {
        global::System.Object _java_exception = ex.getJavaException();
        if (_java_exception is java.lang.NoSuchFieldError) {
            _ex = ex;
            goto label50;
        }
        throw ex;
    } // end catch
    label50:;
    _r0_o = _ex.getJavaException();
    _ex = null;
    _r0_o = new java.io.InvalidClassException();
    _r1_o = ((java.io.ObjectStreamClass) _r10_o).getName();
    ((java.io.InvalidClassException) _r0_o).@this((java.lang.String) _r1_o);
    throw new org.xmlvm._nExceptionAdapter((java.io.InvalidClassException) _r0_o);
    label61:;
    try {
    _r4_o = ((java.io.ObjectOutputStream) _r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getByte
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getByte");
    ((java.io.DataOutputStream) _r4_o).writeByte((int) _r5.i);
    }
    catch (org.xmlvm._nExceptionAdapter ex) {
        global::System.Object _java_exception = ex.getJavaException();
        if (_java_exception is java.lang.NoSuchFieldError) {
            _ex = ex;
            goto label50;
        }
        throw ex;
    } // end catch
    label72:;
    try {
    _r3.i = _r3.i + 1;
    goto label10;
    }
    catch (org.xmlvm._nExceptionAdapter ex) {
        global::System.Object _java_exception = ex.getJavaException();
        if (_java_exception is java.lang.NoSuchFieldError) {
            _ex = ex;
            goto label50;
        }
        throw ex;
    } // end catch
    label75:;
    try {
    _r4_o = ((java.io.ObjectOutputStream) _r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getChar
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getChar");
    ((java.io.DataOutputStream) _r4_o).writeChar((int) _r5.i);
    goto label72;
    }
    catch (org.xmlvm._nExceptionAdapter ex) {
        global::System.Object _java_exception = ex.getJavaException();
        if (_java_exception is java.lang.NoSuchFieldError) {
            _ex = ex;
            goto label50;
        }
        throw ex;
    } // end catch
    label87:;
    try {
    _r4_o = ((java.io.ObjectOutputStream) _r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getDouble
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getDouble");
    ((java.io.DataOutputStream) _r4_o).writeDouble((double) _r5.d);
    goto label72;
    }
    catch (org.xmlvm._nExceptionAdapter ex) {
        global::System.Object _java_exception = ex.getJavaException();
        if (_java_exception is java.lang.NoSuchFieldError) {
            _ex = ex;
            goto label50;
        }
        throw ex;
    } // end catch
    label99:;
    try {
    _r4_o = ((java.io.ObjectOutputStream) _r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getFloat
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getFloat");
    ((java.io.DataOutputStream) _r4_o).writeFloat((float) _r5.f);
    goto label72;
    }
    catch (org.xmlvm._nExceptionAdapter ex) {
        global::System.Object _java_exception = ex.getJavaException();
        if (_java_exception is java.lang.NoSuchFieldError) {
            _ex = ex;
            goto label50;
        }
        throw ex;
    } // end catch
    label111:;
    try {
    _r4_o = ((java.io.ObjectOutputStream) _r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getInt
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getInt");
    ((java.io.DataOutputStream) _r4_o).writeInt((int) _r5.i);
    goto label72;
    }
    catch (org.xmlvm._nExceptionAdapter ex) {
        global::System.Object _java_exception = ex.getJavaException();
        if (_java_exception is java.lang.NoSuchFieldError) {
            _ex = ex;
            goto label50;
        }
        throw ex;
    } // end catch
    label123:;
    try {
    _r4_o = ((java.io.ObjectOutputStream) _r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getLong
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getLong");
    ((java.io.DataOutputStream) _r4_o).writeLong((long) _r5.l);
    goto label72;
    }
    catch (org.xmlvm._nExceptionAdapter ex) {
        global::System.Object _java_exception = ex.getJavaException();
        if (_java_exception is java.lang.NoSuchFieldError) {
            _ex = ex;
            goto label50;
        }
        throw ex;
    } // end catch
    label135:;
    try {
    _r4_o = ((java.io.ObjectOutputStream) _r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getShort
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getShort");
    ((java.io.DataOutputStream) _r4_o).writeShort((int) _r5.i);
    goto label72;
    }
    catch (org.xmlvm._nExceptionAdapter ex) {
        global::System.Object _java_exception = ex.getJavaException();
        if (_java_exception is java.lang.NoSuchFieldError) {
            _ex = ex;
            goto label50;
        }
        throw ex;
    } // end catch
    label147:;
    try {
    _r4_o = ((java.io.ObjectOutputStream) _r8_o)._foutput;
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getBoolean
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getBoolean");
    ((java.io.DataOutputStream) _r4_o).writeBoolean(0!=_r5.i);
    goto label72;
    }
    catch (org.xmlvm._nExceptionAdapter ex) {
        global::System.Object _java_exception = ex.getJavaException();
        if (_java_exception is java.lang.NoSuchFieldError) {
            _ex = ex;
            goto label50;
        }
        throw ex;
    } // end catch
    label159:;
    try {
// Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: java.io.ObjectOutputStream,org.apache.harmony.misc.accessors.ObjectAccessor accessor");
// Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getObject
throw new org.xmlvm._nNotYetImplementedException("Red class access removed: org.apache.harmony.misc.accessors.ObjectAccessor getObject");
    _r4.i = ((java.io.ObjectStreamField) _r4_o).isUnshared() ? 1 : 0;
    if (_r4.i == 0) goto label175;
    ((java.io.ObjectOutputStream) _r8_o).writeUnshared((java.lang.Object) _r5_o);
    goto label72;
    }
    catch (org.xmlvm._nExceptionAdapter ex) {
        global::System.Object _java_exception = ex.getJavaException();
        if (_java_exception is java.lang.NoSuchFieldError) {
            _ex = ex;
            goto label50;
        }
        throw ex;
    } // end catch
    label175:;
    try {
    ((java.io.ObjectOutputStream) _r8_o).writeObject((java.lang.Object) _r5_o);
    }
    catch (org.xmlvm._nExceptionAdapter ex) {
        global::System.Object _java_exception = ex.getJavaException();
        if (_java_exception is java.lang.NoSuchFieldError) {
            _ex = ex;
            goto label50;
        }
        throw ex;
    } // end catch
    goto label72;
//XMLVM_END_WRAPPER[java.io.ObjectOutputStream: void writeFieldValues(java.lang.Object, java.io.ObjectStreamClass)]
}