ObjectOutputStream.WriteObject(Object) Method

Definition

Write the specified object to the ObjectOutputStream.

[Android.Runtime.Register("writeObject", "(Ljava/lang/Object;)V", "")]
public void WriteObject (Java.Lang.Object? obj);
[<Android.Runtime.Register("writeObject", "(Ljava/lang/Object;)V", "")>]
abstract member WriteObject : Java.Lang.Object -> unit
override this.WriteObject : Java.Lang.Object -> unit

Parameters

obj
Object

Implements

Attributes

Exceptions

if an error occurs while writing to the target stream.

Remarks

Write the specified object to the ObjectOutputStream. The class of the object, the signature of the class, and the values of the non-transient and non-static fields of the class and all of its supertypes are written. Default serialization for a class can be overridden using the writeObject and the readObject methods. Objects referenced by this object are written transitively so that a complete equivalent graph of objects can be reconstructed by an ObjectInputStream.

Exceptions are thrown for problems with the OutputStream and for classes that should not be serialized. All exceptions are fatal to the OutputStream, which is left in an indeterminate state, and it is up to the caller to ignore or recover the stream state.

Java documentation for java.io.ObjectOutputStream.writeObject(java.lang.Object).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also