Example #1
0
        internal static void writeObject(Exception x, ObjectOutputStream s)
        {
#if !FIRST_PASS
            lock (x)
            {
                ObjectOutputStream.PutField fields = s.putFields();
                Throwable _thisJava = x as Throwable;
                if (_thisJava == null)
                {
                    fields.put("detailMessage", x.Message);
                    fields.put("cause", x.InnerException);
                    // suppressed exceptions are not supported on CLR exceptions
                    fields.put("suppressedExceptions", null);
                    fields.put("stackTrace", getOurStackTrace(x));
                }
                else
                {
                    fields.put("detailMessage", _thisJava.detailMessage);
                    fields.put("cause", _thisJava.cause);
                    fields.put("suppressedExceptions", _thisJava.suppressedExceptions);
                    getOurStackTrace(x);
                    fields.put("stackTrace", _thisJava.stackTrace ?? java.lang.ThrowableHelper.SentinelHolder.STACK_TRACE_SENTINEL);
                }
                s.writeFields();
            }
#endif
        }
        /// <summary>
        /// Writes this object out to a stream (i.e., serializes it).
        ///
        /// @serialData An initial {@code String} denoting the
        /// {@code type} is followed by a {@code String} denoting the
        /// {@code name} is followed by a {@code String} denoting the
        /// {@code actions} is followed by an {@code int} indicating the
        /// number of certificates to follow
        /// (a value of "zero" denotes that there are no certificates associated
        /// with this object).
        /// Each certificate is written out starting with a {@code String}
        /// denoting the certificate type, followed by an
        /// {@code int} specifying the length of the certificate encoding,
        /// followed by the certificate encoding itself which is written out as an
        /// array of bytes.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void writeObject(java.io.ObjectOutputStream oos) throws java.io.IOException
        private void WriteObject(java.io.ObjectOutputStream oos)
        {
            oos.DefaultWriteObject();

            if (Certs == null || Certs.Length == 0)
            {
                oos.WriteInt(0);
            }
            else
            {
                // write out the total number of certs
                oos.WriteInt(Certs.Length);
                // write out each cert, including its type
                for (int i = 0; i < Certs.Length; i++)
                {
                    java.security.cert.Certificate cert = Certs[i];
                    try
                    {
                        oos.WriteUTF(cert.Type);
                        sbyte[] encoded = cert.Encoded;
                        oos.WriteInt(encoded.Length);
                        oos.Write(encoded);
                    }
                    catch (CertificateEncodingException cee)
                    {
                        throw new IOException(cee.Message);
                    }
                }
            }
        }
Example #3
0
        protected void SaveStateInClient(FacesContext facesContext, StateManager.SerializedView serializedView)
        {
            //UIViewRoot uiViewRoot = facesContext.getViewRoot ();
            ////save state in response (client-side: full state; server-side: sequence)
            //RenderKit renderKit = RenderKitFactory.getRenderKit (facesContext, uiViewRoot.getRenderKitId ());
            //// not us.
            //renderKit.getResponseStateManager ().writeState (facesContext, serializedView);

            java.io.ByteArrayOutputStream bytearrayoutputstream = new java.io.ByteArrayOutputStream();
            java.io.ObjectOutputStream    objectoutputstream    = new java.io.ObjectOutputStream(bytearrayoutputstream);

            //ignore tree structure
            //objectoutputstream.writeObject (serializedView.getStructure ());
            objectoutputstream.writeObject(serializedView.getState());
            objectoutputstream.close();
            bytearrayoutputstream.close();

            string s =
                @"<div>
	<input type=""hidden"" name="""     + VIEWSTATE + "\" id=\"" + VIEWSTATE + "\" value=\"" +
                Convert.ToBase64String((byte [])vmw.common.TypeUtils.ToByteArray(bytearrayoutputstream.toByteArray())) + @""" />
</div>";

            facesContext.getResponseWriter().write(s);
        }
Example #4
0
        /// <summary>
        /// <code>writeObject</code> for custom serialization.
        ///
        /// <para>This method writes this object's serialized form for this class
        /// as follows:
        ///
        /// </para>
        /// <para>The <seealso cref="RemoteRef#getRefClass(java.io.ObjectOutput) getRefClass"/>
        /// method is invoked on this object's <code>ref</code> field
        /// to obtain its external ref type name.
        /// If the value returned by <code>getRefClass</code> was
        /// a non-<code>null</code> string of length greater than zero,
        /// the <code>writeUTF</code> method is invoked on <code>out</code>
        /// with the value returned by <code>getRefClass</code>, and then
        /// the <code>writeExternal</code> method is invoked on
        /// this object's <code>ref</code> field passing <code>out</code>
        /// as the argument; otherwise,
        /// the <code>writeUTF</code> method is invoked on <code>out</code>
        /// with a zero-length string (<code>""</code>), and then
        /// the <code>writeObject</code> method is invoked on <code>out</code>
        /// passing this object's <code>ref</code> field as the argument.
        ///
        /// @serialData
        ///
        /// The serialized data for this class comprises a string (written with
        /// <code>ObjectOutput.writeUTF</code>) that is either the external
        /// ref type name of the contained <code>RemoteRef</code> instance
        /// (the <code>ref</code> field) or a zero-length string, followed by
        /// either the external form of the <code>ref</code> field as written by
        /// its <code>writeExternal</code> method if the string was of non-zero
        /// length, or the serialized form of the <code>ref</code> field as
        /// written by passing it to the serialization stream's
        /// <code>writeObject</code> if the string was of zero length.
        ///
        /// </para>
        /// <para>If this object is an instance of
        /// <seealso cref="RemoteStub"/> or <seealso cref="RemoteObjectInvocationHandler"/>
        /// that was returned from any of
        /// the <code>UnicastRemoteObject.exportObject</code> methods
        /// and custom socket factories are not used,
        /// the external ref type name is <code>"UnicastRef"</code>.
        ///
        /// If this object is an instance of
        /// <code>RemoteStub</code> or <code>RemoteObjectInvocationHandler</code>
        /// that was returned from any of
        /// the <code>UnicastRemoteObject.exportObject</code> methods
        /// and custom socket factories are used,
        /// the external ref type name is <code>"UnicastRef2"</code>.
        ///
        /// If this object is an instance of
        /// <code>RemoteStub</code> or <code>RemoteObjectInvocationHandler</code>
        /// that was returned from any of
        /// the <code>java.rmi.activation.Activatable.exportObject</code> methods,
        /// the external ref type name is <code>"ActivatableRef"</code>.
        ///
        /// If this object is an instance of
        /// <code>RemoteStub</code> or <code>RemoteObjectInvocationHandler</code>
        /// that was returned from
        /// the <code>RemoteObject.toStub</code> method (and the argument passed
        /// to <code>toStub</code> was not itself a <code>RemoteStub</code>),
        /// the external ref type name is a function of how the remote object
        /// passed to <code>toStub</code> was exported, as described above.
        ///
        /// If this object is an instance of
        /// <code>RemoteStub</code> or <code>RemoteObjectInvocationHandler</code>
        /// that was originally created via deserialization,
        /// the external ref type name is the same as that which was read
        /// when this object was deserialized.
        ///
        /// </para>
        /// <para>If this object is an instance of
        /// <code>java.rmi.server.UnicastRemoteObject</code> that does not
        /// use custom socket factories,
        /// the external ref type name is <code>"UnicastServerRef"</code>.
        ///
        /// If this object is an instance of
        /// <code>UnicastRemoteObject</code> that does
        /// use custom socket factories,
        /// the external ref type name is <code>"UnicastServerRef2"</code>.
        ///
        /// </para>
        /// <para>Following is the data that must be written by the
        /// <code>writeExternal</code> method and read by the
        /// <code>readExternal</code> method of <code>RemoteRef</code>
        /// implementation classes that correspond to the each of the
        /// defined external ref type names:
        ///
        /// </para>
        /// <para>For <code>"UnicastRef"</code>:
        ///
        /// <ul>
        ///
        /// <li>the hostname of the referenced remote object,
        /// written by <seealso cref="java.io.ObjectOutput#writeUTF(String)"/>
        ///
        /// <li>the port of the referenced remote object,
        /// written by <seealso cref="java.io.ObjectOutput#writeInt(int)"/>
        ///
        /// <li>the data written as a result of calling
        /// {link java.rmi.server.ObjID#write(java.io.ObjectOutput)}
        /// on the <code>ObjID</code> instance contained in the reference
        ///
        /// <li>the boolean value <code>false</code>,
        /// written by <seealso cref="java.io.ObjectOutput#writeBoolean(boolean)"/>
        ///
        /// </ul>
        ///
        /// </para>
        /// <para>For <code>"UnicastRef2"</code> with a
        /// <code>null</code> client socket factory:
        ///
        /// <ul>
        ///
        /// <li>the byte value <code>0x00</code>
        /// (indicating <code>null</code> client socket factory),
        /// written by <seealso cref="java.io.ObjectOutput#writeByte(int)"/>
        ///
        /// <li>the hostname of the referenced remote object,
        /// written by <seealso cref="java.io.ObjectOutput#writeUTF(String)"/>
        ///
        /// <li>the port of the referenced remote object,
        /// written by <seealso cref="java.io.ObjectOutput#writeInt(int)"/>
        ///
        /// <li>the data written as a result of calling
        /// {link java.rmi.server.ObjID#write(java.io.ObjectOutput)}
        /// on the <code>ObjID</code> instance contained in the reference
        ///
        /// <li>the boolean value <code>false</code>,
        /// written by <seealso cref="java.io.ObjectOutput#writeBoolean(boolean)"/>
        ///
        /// </ul>
        ///
        /// </para>
        /// <para>For <code>"UnicastRef2"</code> with a
        /// non-<code>null</code> client socket factory:
        ///
        /// <ul>
        ///
        /// <li>the byte value <code>0x01</code>
        /// (indicating non-<code>null</code> client socket factory),
        /// written by <seealso cref="java.io.ObjectOutput#writeByte(int)"/>
        ///
        /// <li>the hostname of the referenced remote object,
        /// written by <seealso cref="java.io.ObjectOutput#writeUTF(String)"/>
        ///
        /// <li>the port of the referenced remote object,
        /// written by <seealso cref="java.io.ObjectOutput#writeInt(int)"/>
        ///
        /// <li>a client socket factory (object of type
        /// <code>java.rmi.server.RMIClientSocketFactory</code>),
        /// written by passing it to an invocation of
        /// <code>writeObject</code> on the stream instance
        ///
        /// <li>the data written as a result of calling
        /// {link java.rmi.server.ObjID#write(java.io.ObjectOutput)}
        /// on the <code>ObjID</code> instance contained in the reference
        ///
        /// <li>the boolean value <code>false</code>,
        /// written by <seealso cref="java.io.ObjectOutput#writeBoolean(boolean)"/>
        ///
        /// </ul>
        ///
        /// </para>
        /// <para>For <code>"ActivatableRef"</code> with a
        /// <code>null</code> nested remote reference:
        ///
        /// <ul>
        ///
        /// <li>an instance of
        /// <code>java.rmi.activation.ActivationID</code>,
        /// written by passing it to an invocation of
        /// <code>writeObject</code> on the stream instance
        ///
        /// <li>a zero-length string (<code>""</code>),
        /// written by <seealso cref="java.io.ObjectOutput#writeUTF(String)"/>
        ///
        /// </ul>
        ///
        /// </para>
        /// <para>For <code>"ActivatableRef"</code> with a
        /// non-<code>null</code> nested remote reference:
        ///
        /// <ul>
        ///
        /// <li>an instance of
        /// <code>java.rmi.activation.ActivationID</code>,
        /// written by passing it to an invocation of
        /// <code>writeObject</code> on the stream instance
        ///
        /// <li>the external ref type name of the nested remote reference,
        /// which must be <code>"UnicastRef2"</code>,
        /// written by <seealso cref="java.io.ObjectOutput#writeUTF(String)"/>
        ///
        /// <li>the external form of the nested remote reference,
        /// written by invoking its <code>writeExternal</code> method
        /// with the stream instance
        /// (see the description of the external form for
        /// <code>"UnicastRef2"</code> above)
        ///
        /// </ul>
        ///
        /// </para>
        /// <para>For <code>"UnicastServerRef"</code> and
        /// <code>"UnicastServerRef2"</code>, no data is written by the
        /// <code>writeExternal</code> method or read by the
        /// <code>readExternal</code> method.
        /// </para>
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException, java.lang.ClassNotFoundException
        private void WriteObject(java.io.ObjectOutputStream @out)
        {
            if (@ref == null)
            {
                throw new java.rmi.MarshalException("Invalid remote object");
            }
            else
            {
                String refClassName = @ref.GetRefClass(@out);
                if (refClassName == null || refClassName.Length() == 0)
                {
                    /*
                     * No reference class name specified, so serialize
                     * remote reference.
                     */
                    @out.WriteUTF("");
                    @out.WriteObject(@ref);
                }
                else
                {
                    /*
                     * Built-in reference class specified, so delegate
                     * to reference to write out its external form.
                     */
                    @out.WriteUTF(refClassName);
                    @ref.WriteExternal(@out);
                }
            }
        }
Example #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: void internalWriteEntries(java.io.ObjectOutputStream s) throws java.io.IOException
        internal virtual void InternalWriteEntries(java.io.ObjectOutputStream s)
        {
            for (LinkedHashMap.Entry <K, V> e = Head; e != Map_Fields.Null; e = e.After)
            {
                s.WriteObject(e.Key_Renamed);
                s.WriteObject(e.Value_Renamed);
            }
        }
Example #6
0
        /// <summary>
        /// Writes this object out to a stream (i.e., serializes it).
        /// We check the guard if there is one.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void writeObject(java.io.ObjectOutputStream oos) throws java.io.IOException
        private void WriteObject(java.io.ObjectOutputStream oos)
        {
            if (Guard != null)
            {
                Guard.CheckGuard(@object);
            }

            oos.DefaultWriteObject();
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void writeObject(java.io.ObjectOutputStream s) throws java.lang.ClassNotFoundException, java.io.IOException
        private void WriteObject(java.io.ObjectOutputStream s)
        {
            // sigh -- 1.3 expects transform is never null, so we need to always write one out
            if (this.Transform_Renamed == null)
            {
                this.Transform_Renamed = new AffineTransform();
            }
            s.DefaultWriteObject();
        }
 public virtual void TestSerializePolyline()
 {
     try
     {
         java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream    oo        = new java.io.ObjectOutputStream(streamOut);
         com.epl.geometry.Polyline     pt        = new com.epl.geometry.Polyline();
         pt.StartPath(10, 10);
         pt.LineTo(100, 100);
         pt.LineTo(200, 100);
         oo.WriteObject(pt);
         System.IO.BinaryWriter    streamIn = new System.IO.BinaryWriter(streamOut.ToByteArray());
         java.io.ObjectInputStream ii       = new java.io.ObjectInputStream(streamIn);
         com.epl.geometry.Polyline ptRes    = (com.epl.geometry.Polyline)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         Fail("Polyline serialization failure");
     }
     //try
     //{
     //FileOutputStream streamOut = new FileOutputStream("c:/temp/savedPolyline1.txt");
     //ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     //Polyline pt = new Polyline();
     //pt.startPath(10, 10);
     //pt.lineTo(100, 100);
     //pt.lineTo(200, 100);
     //oo.writeObject(pt);
     //}
     //catch(Exception ex)
     //{
     //fail("Polyline serialization failure");
     //}
     try
     {
         java.io.InputStream       s     = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedPolyline.txt");
         java.io.ObjectInputStream ii    = new java.io.ObjectInputStream(s);
         com.epl.geometry.Polyline ptRes = (com.epl.geometry.Polyline)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes != null);
     }
     catch (System.Exception)
     {
         Fail("Polyline serialization failure");
     }
     try
     {
         java.io.InputStream       s     = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedPolyline1.txt");
         java.io.ObjectInputStream ii    = new java.io.ObjectInputStream(s);
         com.epl.geometry.Polyline ptRes = (com.epl.geometry.Polyline)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes != null);
     }
     catch (System.Exception)
     {
         Fail("Polyline serialization failure");
     }
 }
 public virtual void TestSerializeMultiPoint()
 {
     try
     {
         java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream    oo        = new java.io.ObjectOutputStream(streamOut);
         com.epl.geometry.MultiPoint   pt        = new com.epl.geometry.MultiPoint();
         pt.Add(10, 30);
         pt.Add(120, 40);
         oo.WriteObject(pt);
         System.IO.BinaryWriter      streamIn = new System.IO.BinaryWriter(streamOut.ToByteArray());
         java.io.ObjectInputStream   ii       = new java.io.ObjectInputStream(streamIn);
         com.epl.geometry.MultiPoint ptRes    = (com.epl.geometry.MultiPoint)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         Fail("MultiPoint serialization failure");
     }
     //try
     //{
     //FileOutputStream streamOut = new FileOutputStream("c:/temp/savedMultiPoint1.txt");
     //ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     //MultiPoint pt = new MultiPoint();
     //pt.add(10, 30);
     //pt.add(120, 40);
     //oo.writeObject(pt);
     //}
     //catch(Exception ex)
     //{
     //fail("MultiPoint serialization failure");
     //}
     try
     {
         java.io.InputStream         s     = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedMultiPoint.txt");
         java.io.ObjectInputStream   ii    = new java.io.ObjectInputStream(s);
         com.epl.geometry.MultiPoint ptRes = (com.epl.geometry.MultiPoint)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.GetPoint(1).GetY() == 40);
     }
     catch (System.Exception)
     {
         Fail("MultiPoint serialization failure");
     }
     try
     {
         java.io.InputStream         s     = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedMultiPoint1.txt");
         java.io.ObjectInputStream   ii    = new java.io.ObjectInputStream(s);
         com.epl.geometry.MultiPoint ptRes = (com.epl.geometry.MultiPoint)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.GetPoint(1).GetY() == 40);
     }
     catch (System.Exception)
     {
         Fail("MultiPoint serialization failure");
     }
 }
Example #10
0
        /// <summary>
        /// readObject is called to restore the state of the StringBuffer from
        /// a stream.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException
        private void WriteObject(java.io.ObjectOutputStream s)
        {
            lock (this)
            {
                java.io.ObjectOutputStream.PutField fields = s.PutFields();
                fields.Put("value", Value_Renamed);
                fields.Put("count", Count);
                fields.Put("shared", false);
                s.WriteFields();
            }
        }
Example #11
0
 /// <exception cref="System.IO.IOException"></exception>
 private void writeObject(java.io.ObjectOutputStream @out)
 {
     lock (this)
     {
         java.io.ObjectOutputStream.PutField fields = @out.putFields();
         fields.put("count", Length);
         fields.put("shared", false);
         fields.put("value", getValue());
         @out.writeFields();
     }
 }
Example #12
0
 private void writeObject(java.io.ObjectOutputStream oos)
 {
     if (m_modelData != null)
     {
         oos.writeInt(3);
         oos.writeInt(m_modelData.Length);
         oos.write(m_modelData, 0, m_modelData.Length);
         oos.writeBoolean(m_mustValue.HasValue);
         oos.writeInt(m_mustValue.HasValue ? m_mustValue.Value : 0);
         oos.writeDouble(m_delta.Value);
     }
 }
 public virtual void TestSerializeEnvelope()
 {
     try
     {
         java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream    oo        = new java.io.ObjectOutputStream(streamOut);
         com.epl.geometry.Envelope     pt        = new com.epl.geometry.Envelope(10, 10, 400, 300);
         oo.WriteObject(pt);
         System.IO.BinaryWriter    streamIn = new System.IO.BinaryWriter(streamOut.ToByteArray());
         java.io.ObjectInputStream ii       = new java.io.ObjectInputStream(streamIn);
         com.epl.geometry.Envelope ptRes    = (com.epl.geometry.Envelope)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         Fail("Envelope serialization failure");
     }
     //try
     //{
     //FileOutputStream streamOut = new FileOutputStream("c:/temp/savedEnvelope1.txt");
     //ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     //Envelope pt = new Envelope(10, 10, 400, 300);
     //oo.writeObject(pt);
     //}
     //catch(Exception ex)
     //{
     //fail("Envelope serialization failure");
     //}
     try
     {
         java.io.InputStream       s     = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedEnvelope.txt");
         java.io.ObjectInputStream ii    = new java.io.ObjectInputStream(s);
         com.epl.geometry.Envelope ptRes = (com.epl.geometry.Envelope)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.GetXMax() == 400);
     }
     catch (System.Exception)
     {
         Fail("Envelope serialization failure");
     }
     try
     {
         java.io.InputStream       s     = typeof(com.epl.geometry.TestSerialization).GetResourceAsStream("savedEnvelope1.txt");
         java.io.ObjectInputStream ii    = new java.io.ObjectInputStream(s);
         com.epl.geometry.Envelope ptRes = (com.epl.geometry.Envelope)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.GetXMax() == 400);
     }
     catch (System.Exception)
     {
         Fail("Envelope serialization failure");
     }
 }
Example #14
0
 public virtual void testSerializePolyline()
 {
     try
     {
         java.io.ByteArrayOutputStream   streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream      oo        = new java.io.ObjectOutputStream(streamOut);
         com.esri.core.geometry.Polyline pt        = new com.esri.core.geometry.Polyline();
         pt.startPath(10, 10);
         pt.lineTo(100, 100);
         pt.lineTo(200, 100);
         oo.writeObject(pt);
         java.io.ByteArrayInputStream streamIn = new java.io.ByteArrayInputStream(streamOut
                                                                                  .toByteArray());
         java.io.ObjectInputStream       ii    = new java.io.ObjectInputStream(streamIn);
         com.esri.core.geometry.Polyline ptRes = (com.esri.core.geometry.Polyline)ii.readObject
                                                     ();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         fail("Polyline serialization failure");
     }
     // try
     // {
     // FileOutputStream streamOut = new FileOutputStream(m_thisDirectory +
     // "savedPolyline.txt");
     // ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     // Polyline pt = new Polyline();
     // pt.startPath(10, 10);
     // pt.lineTo(100, 100);
     // pt.lineTo(200, 100);
     // oo.writeObject(pt);
     // }
     // catch(Exception ex)
     // {
     // fail("Polyline serialization failure");
     // }
     try
     {
         java.io.InputStream s = Sharpen.Runtime.getClassForType(typeof(com.esri.core.geometry.TestSerialization
                                                                        )).getResourceAsStream("savedPolyline.txt");
         java.io.ObjectInputStream       ii    = new java.io.ObjectInputStream(s);
         com.esri.core.geometry.Polyline ptRes = (com.esri.core.geometry.Polyline)ii.readObject
                                                     ();
         NUnit.Framework.Assert.IsTrue(ptRes != null);
     }
     catch (System.Exception)
     {
         fail("Polyline serialization failure");
     }
 }
Example #15
0
 public virtual void testSerializeMultiPoint()
 {
     try
     {
         java.io.ByteArrayOutputStream     streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream        oo        = new java.io.ObjectOutputStream(streamOut);
         com.esri.core.geometry.MultiPoint pt        = new com.esri.core.geometry.MultiPoint();
         pt.add(10, 30);
         pt.add(120, 40);
         oo.writeObject(pt);
         java.io.ByteArrayInputStream streamIn = new java.io.ByteArrayInputStream(streamOut
                                                                                  .toByteArray());
         java.io.ObjectInputStream         ii    = new java.io.ObjectInputStream(streamIn);
         com.esri.core.geometry.MultiPoint ptRes = (com.esri.core.geometry.MultiPoint)ii.readObject
                                                       ();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception)
     {
         fail("MultiPoint serialization failure");
     }
     // try
     // {
     // FileOutputStream streamOut = new FileOutputStream(m_thisDirectory +
     // "savedMultiPoint.txt");
     // ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     // MultiPoint pt = new MultiPoint();
     // pt.add(10, 30);
     // pt.add(120, 40);
     // oo.writeObject(pt);
     // }
     // catch(Exception ex)
     // {
     // fail("MultiPoint serialization failure");
     // }
     try
     {
         java.io.InputStream s = Sharpen.Runtime.getClassForType(typeof(com.esri.core.geometry.TestSerialization
                                                                        )).getResourceAsStream("savedMultiPoint.txt");
         java.io.ObjectInputStream         ii    = new java.io.ObjectInputStream(s);
         com.esri.core.geometry.MultiPoint ptRes = (com.esri.core.geometry.MultiPoint)ii.readObject
                                                       ();
         NUnit.Framework.Assert.IsTrue(ptRes.getPoint(1).getY() == 40);
     }
     catch (System.Exception)
     {
         fail("MultiPoint serialization failure");
     }
 }
Example #16
0
 public virtual void testSerializeEnvelope2D()
 {
     try
     {
         java.io.ByteArrayOutputStream     streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream        oo        = new java.io.ObjectOutputStream(streamOut);
         com.esri.core.geometry.Envelope2D env       = new com.esri.core.geometry.Envelope2D(1.213948734
                                                                                             , 2.213948734, 11.213948734, 12.213948734);
         oo.writeObject(env);
         java.io.ByteArrayInputStream streamIn = new java.io.ByteArrayInputStream(streamOut
                                                                                  .toByteArray());
         java.io.ObjectInputStream         ii     = new java.io.ObjectInputStream(streamIn);
         com.esri.core.geometry.Envelope2D envRes = (com.esri.core.geometry.Envelope2D)ii.
                                                    readObject();
         NUnit.Framework.Assert.IsTrue(envRes.Equals(env));
     }
     catch (System.Exception)
     {
         fail("Envelope2D serialization failure");
     }
     //		try
     //		{
     //			 FileOutputStream streamOut = new FileOutputStream(
     //			 "c:/temp/savedEnvelope2D.txt");
     //			 ObjectOutputStream oo = new ObjectOutputStream(streamOut);
     //			 Envelope2D e = new Envelope2D(177.123, 188.234, 999.122, 888.999);
     //			 oo.writeObject(e);
     //		 }
     //		 catch(Exception ex)
     //		 {
     //		   fail("Envelope2D serialization failure");
     //		 }
     try
     {
         java.io.InputStream s = Sharpen.Runtime.getClassForType(typeof(com.esri.core.geometry.TestSerialization
                                                                        )).getResourceAsStream("savedEnvelope2D.txt");
         java.io.ObjectInputStream         ii = new java.io.ObjectInputStream(s);
         com.esri.core.geometry.Envelope2D e  = (com.esri.core.geometry.Envelope2D)ii.readObject
                                                    ();
         NUnit.Framework.Assert.IsTrue(e != null);
         NUnit.Framework.Assert.IsTrue(e.Equals(new com.esri.core.geometry.Envelope2D(177.123
                                                                                      , 188.234, 999.122, 888.999)));
     }
     catch (System.Exception)
     {
         fail("Envelope2D serialization failure");
     }
 }
Example #17
0
 public static bool writeObjectToFile(string fileName, object obj)
 {
     try
     {
         java.io.File f = new java.io.File(fileName);
         f.setWritable(true);
         java.io.FileOutputStream   fout = new java.io.FileOutputStream(f);
         java.io.ObjectOutputStream oo   = new java.io.ObjectOutputStream(fout);
         oo.writeObject(obj);
         fout.close();
         return(true);
     }
     catch (System.Exception)
     {
         return(false);
     }
 }
Example #18
0
        internal static void writeObject(Exception x, ObjectOutputStream s)
        {
#if !FIRST_PASS
            lock (x)
            {
                ObjectOutputStream.PutField fields = s.putFields();
                fields.put("detailMessage", Throwable.instancehelper_getMessage(x));
                Exception cause = Throwable.instancehelper_getCause(x);
                if (cause == null && x is Throwable)
                {
                    cause = ((Throwable)x).cause;
                }
                fields.put("cause", cause);
                fields.put("stackTrace", Throwable.instancehelper_getStackTrace(x));
                s.writeFields();
            }
#endif
        }
 public virtual void TestSerializeSR()
 {
     try
     {
         java.io.ByteArrayOutputStream     streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream        oo        = new java.io.ObjectOutputStream(streamOut);
         com.epl.geometry.SpatialReference sr        = com.epl.geometry.SpatialReference.Create(102100);
         oo.WriteObject(sr);
         System.IO.BinaryWriter            streamIn = new System.IO.BinaryWriter(streamOut.ToByteArray());
         java.io.ObjectInputStream         ii       = new java.io.ObjectInputStream(streamIn);
         com.epl.geometry.SpatialReference ptRes    = (com.epl.geometry.SpatialReference)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(sr));
     }
     catch (System.Exception)
     {
         Fail("Spatial Reference serialization failure");
     }
 }
 public virtual void TestSerializeLine()
 {
     try
     {
         java.io.ByteArrayOutputStream streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream    oo        = new java.io.ObjectOutputStream(streamOut);
         com.epl.geometry.Line         pt        = new com.epl.geometry.Line();
         pt.SetStart(new com.epl.geometry.Point(10, 30));
         pt.SetEnd(new com.epl.geometry.Point(120, 40));
         oo.WriteObject(pt);
         System.IO.BinaryWriter    streamIn = new System.IO.BinaryWriter(streamOut.ToByteArray());
         java.io.ObjectInputStream ii       = new java.io.ObjectInputStream(streamIn);
         com.epl.geometry.Line     ptRes    = (com.epl.geometry.Line)ii.ReadObject();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(pt));
     }
     catch (System.Exception ex)
     {
         // fail("Line serialization failure");
         NUnit.Framework.Assert.AreEqual(ex.Message, "Cannot serialize this geometry");
     }
 }
Example #21
0
 public virtual void testSerializeSR()
 {
     try
     {
         java.io.ByteArrayOutputStream           streamOut = new java.io.ByteArrayOutputStream();
         java.io.ObjectOutputStream              oo        = new java.io.ObjectOutputStream(streamOut);
         com.esri.core.geometry.SpatialReference sr        = com.esri.core.geometry.SpatialReference
                                                             .create(102100);
         oo.writeObject(sr);
         java.io.ByteArrayInputStream streamIn = new java.io.ByteArrayInputStream(streamOut
                                                                                  .toByteArray());
         java.io.ObjectInputStream ii = new java.io.ObjectInputStream(streamIn);
         com.esri.core.geometry.SpatialReference ptRes = (com.esri.core.geometry.SpatialReference
                                                          )ii.readObject();
         NUnit.Framework.Assert.IsTrue(ptRes.Equals(sr));
     }
     catch (System.Exception)
     {
         fail("Spatial Reference serialization failure");
     }
 }
Example #22
0
		protected void SaveStateInClient (FacesContext facesContext, StateManager.SerializedView serializedView) {
			//UIViewRoot uiViewRoot = facesContext.getViewRoot ();
			////save state in response (client-side: full state; server-side: sequence)
			//RenderKit renderKit = RenderKitFactory.getRenderKit (facesContext, uiViewRoot.getRenderKitId ());
			//// not us.
			//renderKit.getResponseStateManager ().writeState (facesContext, serializedView);

			java.io.ByteArrayOutputStream bytearrayoutputstream = new java.io.ByteArrayOutputStream ();
			java.io.ObjectOutputStream objectoutputstream = new java.io.ObjectOutputStream (bytearrayoutputstream);

			//ignore tree structure
			//objectoutputstream.writeObject (serializedView.getStructure ());
			objectoutputstream.writeObject (serializedView.getState ());
			objectoutputstream.close ();
			bytearrayoutputstream.close ();

			string s = 
@"<div>
	<input type=""hidden"" name=""" + VIEWSTATE + "\" id=\"" + VIEWSTATE + "\" value=\"" +
				Convert.ToBase64String ((byte []) vmw.common.TypeUtils.ToByteArray (bytearrayoutputstream.toByteArray ())) + @""" />
</div>";
			facesContext.getResponseWriter ().write (s);
		}
Example #23
0
 /// <exception cref="java.io.NotSerializableException"></exception>
 new private void writeObject(java.io.ObjectOutputStream @out)
 {
     throw new java.io.NotSerializableException();
 }
Example #24
0
 /// <exception cref="System.IO.IOException"></exception>
 private void writeObject(java.io.ObjectOutputStream stream)
 {
     stream.defaultWriteObject();
     stream.writeChar(separatorChar);
 }
Example #25
0
        /// <summary>
        /// Writes default serializable fields to stream.
        /// </summary>
        /// <param name="s"> the <code>ObjectOutputStream</code> to write </param>
        /// <seealso cref= AWTEventMulticaster#save(ObjectOutputStream, String, EventListener) </seealso>
        /// <seealso cref= #readObject(java.io.ObjectInputStream) </seealso>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void writeObject(java.io.ObjectOutputStream s) throws java.lang.ClassNotFoundException, java.io.IOException
        private void WriteObject(java.io.ObjectOutputStream s)
        {
            s.DefaultWriteObject();
        }
Example #26
0
 /// <summary>Writes the state of this object to the stream passed.</summary>
 /// <remarks>Writes the state of this object to the stream passed.</remarks>
 /// <param name="out">the stream to write the state to.</param>
 /// <exception cref="System.IO.IOException">if the stream throws it during the write.
 ///     </exception>
 /// <serialData>
 ///
 /// <code>int</code>
 /// - the length of this object.
 /// <code>char[]</code>
 /// - the
 /// buffer from this object, which may be larger than the length
 /// field.
 /// </serialData>
 private void writeObject(java.io.ObjectOutputStream @out)
 {
     @out.defaultWriteObject();
     @out.writeInt(Length);
     @out.writeObject(getValue());
 }
Example #27
0
        /// <summary>
        /// Throws NotSerializableException, since NodeChangeEvent objects are not
        /// intended to be serializable.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void writeObject(java.io.ObjectOutputStream out) throws java.io.NotSerializableException
        private void WriteObject(java.io.ObjectOutputStream @out)
        {
            throw new NotSerializableException("Not serializable.");
        }
Example #28
0
        /// <summary>
        /// Save the state of the {@code StringBuilder} instance to a stream
        /// (that is, serialize it).
        ///
        /// @serialData the number of characters currently stored in the string
        ///             builder ({@code int}), followed by the characters in the
        ///             string builder ({@code char[]}).   The length of the
        ///             {@code char} array may be greater than the number of
        ///             characters currently stored in the string builder, in which
        ///             case extra characters are ignored.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException
        private void WriteObject(java.io.ObjectOutputStream s)
        {
            s.DefaultWriteObject();
            s.WriteInt(Count);
            s.WriteObject(Value_Renamed);
        }
Example #29
0
 private void writeObject(java.io.ObjectOutputStream oos)
 {
     throw new System.NotImplementedException();
 }