Ejemplo n.º 1
0
        internal static bool Test(Object obj)
        {
            if (!(obj is Serializable))
            {
                return(false);
            }

            try
            {
                Stream.WriteObject(obj);
            }
            catch (IOException)
            {
                return(false);
            }
            finally
            {
                // Fix for 4503661.
                // Reset the stream so that it doesn't keep a reference to the
                // written object.
                try
                {
                    Stream.Reset();
                }
                catch (IOException)
                {
                    // Ignore the exception.
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
 // no header
 /// <exception cref="System.IO.IOException"/>
 public virtual void Serialize(Serializable @object)
 {
     oos.Reset();
     // clear (class) back-references
     oos.WriteObject(@object);
 }