Language

JniEnvironment.Types.FindClass Method

Definition

Overloads

Name Description
FindClass(ReadOnlySpan<Byte>)

Finds a Java class using a 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 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 class name encoded as modified UTF-8.

Returns

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

Remarks

When the span is passed directly to JNI, the class name must be terminated in memory. The zero terminator can be inside the span or immediately after it, as with a u8 string literal. 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 packages, such as java/lang/Object.

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