Language

JniEnvironment.Types.FindClass Method

Definition

Overloads

Name Description
FindClass(ReadOnlySpan<Byte>)

Finds a Java class using a null-terminated UTF-8 class name span. Use with "java/lang/Object"u8 literals to avoid string marshalling overhead.

FindClass(String)

Finds a Java class with JNI lookup and a runtime-class-loader fallback.

FindClass(ReadOnlySpan<Byte>)

Finds a Java class using a null-terminated UTF-8 class name span. Use with "java/lang/Object"u8 literals to avoid string marshalling overhead.

public static Java.Interop.JniObjectReference FindClass(ReadOnlySpan<byte> classname);
static member FindClass : ReadOnlySpan<byte> -> Java.Interop.JniObjectReference

Parameters

classname
ReadOnlySpan<Byte>

A nonempty, zero-terminated class name encoded as modified UTF-8.

Returns

A local JNI class reference, which the caller must release.

Remarks

The span must include a terminating zero byte because JNI receives a pointer without the span length. If the initial lookup fails, lookup falls back to the runtime's class loader.

Applies to

FindClass(String)

Finds a Java class with JNI lookup and a runtime-class-loader fallback.

public static Java.Interop.JniObjectReference FindClass(string classname);
static member FindClass : string -> Java.Interop.JniObjectReference

Parameters

classname
String

A nonempty Java class name with slash-separated or dot-separated packages.

Returns

A local JNI class reference, which the caller must release.

Remarks

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