Exemple #1
0
        // Private methods

        /// <summary>
        /// Reconstitute the {@code MathContext} instance from a stream (that is,
        /// deserialize it).
        /// </summary>
        /// <param name="s"> the stream being read. </param>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException
        private void ReadObject(java.io.ObjectInputStream s)
        {
            s.DefaultReadObject();             // read in all fields
            // validate possibly bad fields
            if (Precision_Renamed < MIN_DIGITS)
            {
                String message = "MathContext: invalid digits in stream";
                throw new java.io.StreamCorruptedException(message);
            }
            if (RoundingMode_Renamed == null)
            {
                String message = "MathContext: null roundingMode in stream";
                throw new java.io.StreamCorruptedException(message);
            }
        }
Exemple #2
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 void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException
        private void ReadObject(java.io.ObjectInputStream s)
        {
            s.DefaultReadObject();
            Count         = s.ReadInt();
            Value_Renamed = (char[])s.ReadObject();
        }
        /// <summary>
        /// Restores this object from a stream (i.e., deserializes it).
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void readObject(java.io.ObjectInputStream ois) throws java.io.IOException, ClassNotFoundException
        private void ReadObject(java.io.ObjectInputStream ois)
        {
            CertificateFactory cf;
            Dictionary <String, CertificateFactory> cfs = null;

            ois.DefaultReadObject();

            if (Type == null)
            {
                throw new NullPointerException("type can't be null");
            }

            // process any new-style certs in the stream (if present)
            int size = ois.ReadInt();

            if (size > 0)
            {
                // we know of 3 different cert types: X.509, PGP, SDSI, which
                // could all be present in the stream at the same time
                cfs        = new Dictionary <String, CertificateFactory>(3);
                this.Certs = new java.security.cert.Certificate[size];
            }

            for (int i = 0; i < size; i++)
            {
                // read the certificate type, and instantiate a certificate
                // factory of that type (reuse existing factory if possible)
                String certType = ois.ReadUTF();
                if (cfs.ContainsKey(certType))
                {
                    // reuse certificate factory
                    cf = cfs[certType];
                }
                else
                {
                    // create new certificate factory
                    try
                    {
                        cf = CertificateFactory.GetInstance(certType);
                    }
                    catch (CertificateException)
                    {
                        throw new ClassNotFoundException("Certificate factory for " + certType + " not found");
                    }
                    // store the certificate factory so we can reuse it later
                    cfs[certType] = cf;
                }
                // parse the certificate
                sbyte[] encoded = null;
                try
                {
                    encoded = new sbyte[ois.ReadInt()];
                }
                catch (OutOfMemoryError)
                {
                    throw new IOException("Certificate too big");
                }
                ois.ReadFully(encoded);
                ByteArrayInputStream bais = new ByteArrayInputStream(encoded);
                try
                {
                    this.Certs[i] = cf.GenerateCertificate(bais);
                }
                catch (CertificateException ce)
                {
                    throw new IOException(ce.Message);
                }
                bais.Close();
            }
        }
            /// <summary>
            /// Reconstitutes the instance from a stream (that is, deserializes it).
            /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException
            internal virtual void ReadObject(java.io.ObjectInputStream s)
            {
                s.DefaultReadObject();
                State = 0;                 // reset to unlocked state
            }
        /// <summary>
        /// Re-export the remote object when it is deserialized.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
        private void ReadObject(java.io.ObjectInputStream @in)
        {
            @in.DefaultReadObject();
            Reexport();
        }