ObjectInputStream.ResolveProxyClass(String[]) Method

Definition

Returns a proxy class that implements the interfaces named in a proxy class descriptor; subclasses may implement this method to read custom data from the stream along with the descriptors for dynamic proxy classes, allowing them to use an alternate loading mechanism for the interfaces and the proxy class.

[Android.Runtime.Register("resolveProxyClass", "([Ljava/lang/String;)Ljava/lang/Class;", "GetResolveProxyClass_arrayLjava_lang_String_Handler")]
protected virtual Java.Lang.Class? ResolveProxyClass (string[]? interfaces);
[<Android.Runtime.Register("resolveProxyClass", "([Ljava/lang/String;)Ljava/lang/Class;", "GetResolveProxyClass_arrayLjava_lang_String_Handler")>]
abstract member ResolveProxyClass : string[] -> Java.Lang.Class
override this.ResolveProxyClass : string[] -> Java.Lang.Class

Parameters

interfaces
String[]

the list of interface names that were deserialized in the proxy class descriptor

Returns

a proxy class for the specified interfaces

Attributes

Exceptions

if the proxy class or any of the specified interfaces cannot be created.

if an error occurs while reading from the source stream.

Remarks

Returns a proxy class that implements the interfaces named in a proxy class descriptor; subclasses may implement this method to read custom data from the stream along with the descriptors for dynamic proxy classes, allowing them to use an alternate loading mechanism for the interfaces and the proxy class.

This method is called exactly once for each unique proxy class descriptor in the stream.

The corresponding method in ObjectOutputStream is annotateProxyClass. For a given subclass of ObjectInputStream that overrides this method, the annotateProxyClass method in the corresponding subclass of ObjectOutputStream must write any data or objects read by this method.

The default implementation of this method in ObjectInputStream returns the result of calling Proxy.getProxyClass with the list of Class objects for the interfaces that are named in the interfaces parameter. The Class object for each interface name i is the value returned by calling

Class.forName(i, false, loader)

where loader is that of the first non-null class loader up the execution stack, or null if no non-null class loaders are on the stack (the same class loader choice used by the resolveClass method). Unless any of the resolved interfaces are non-public, this same value of loader is also the class loader passed to Proxy.getProxyClass; if non-public interfaces are present, their class loader is passed instead (if more than one non-public interface class loader is encountered, an IllegalAccessError is thrown). If Proxy.getProxyClass throws an IllegalArgumentException, resolveProxyClass will throw a ClassNotFoundException containing the IllegalArgumentException.

Added in 1.3.

Java documentation for java.io.ObjectInputStream.resolveProxyClass(java.lang.String[]).

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