jni

package
v1.10.0-405ea978f8b-g1... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package jni implements various helper functions for communicating with the Android JVM though JNI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallBooleanMethod added in v0.1.15

func CallBooleanMethod(e *Env, obj Object, method MethodID, args ...Value) (bool, error)

func CallIntMethod

func CallIntMethod(e *Env, obj Object, method MethodID, args ...Value) (int32, error)

func CallStaticIntMethod

func CallStaticIntMethod(e *Env, cls Class, method MethodID, args ...Value) (int, error)

func CallStaticVoidMethod

func CallStaticVoidMethod(e *Env, cls Class, method MethodID, args ...Value) error

func CallVoidMethod

func CallVoidMethod(e *Env, obj Object, method MethodID, args ...Value) error

func DeleteGlobalRef

func DeleteGlobalRef(e *Env, obj Object)

func Do

func Do(vm *JVM, f func(env *Env) error) error

Do invokes a function with a temporary JVM environment. The environment is not valid after the function returns.

func GetBooleanArrayElements

func GetBooleanArrayElements(e *Env, jarr BooleanArray) []bool

GetBooleanArrayElements returns the contents of the boolean array.

func GetByteArrayElements

func GetByteArrayElements(e *Env, jarr ByteArray) []byte

GetByteArrayElements returns the contents of the byte array.

func GetIntArrayElements

func GetIntArrayElements(e *Env, jarr IntArray) []int

GetIntArrayElements returns the contents of the int array.

func GetLongArrayElements

func GetLongArrayElements(e *Env, jarr LongArray) []int64

GetLongArrayElements returns the contents of the long array.

func GetStringArrayElements

func GetStringArrayElements(e *Env, jarr ObjectArray) []string

GetStringArrayElements returns the contents of the String array.

func GoString

func GoString(e *Env, str String) string

GoString converts the JVM jstring to a Go string.

func IsSameObject

func IsSameObject(e *Env, ref1, ref2 Object) bool

Types

type Boolean added in v0.1.13

type Boolean C.jboolean

func Bool

func Bool(b bool) Boolean

type BooleanArray

type BooleanArray C.jbooleanArray

type ByteArray

type ByteArray C.jbyteArray

func NewByteArray

func NewByteArray(e *Env, content []byte) ByteArray

NewByteArray allocates a Java byte array with the content. It panics if the allocation fails.

type Class

type Class C.jclass

func GetObjectClass

func GetObjectClass(e *Env, obj Object) Class

GetObjectClass returns the Java Class for an Object.

func LoadClass

func LoadClass(e *Env, loader Object, class string) (Class, error)

LoadClass invokes the underlying ClassLoader's loadClass method and returns the class.

type Env

type Env C.JNIEnv

type IntArray

type IntArray C.jintArray

type JVM

type JVM C.JavaVM

type LongArray

type LongArray C.jlongArray

type MethodID

type MethodID C.jmethodID

func GetMethodID

func GetMethodID(e *Env, cls Class, name, signature string) MethodID

GetMethodID returns the id for a method. It panics if the method wasn't found.

func GetStaticMethodID

func GetStaticMethodID(e *Env, cls Class, name, signature string) MethodID

GetStaticMethodID returns the id for a static method. It panics if the method wasn't found.

type Object

type Object C.jobject

func CallObjectMethod

func CallObjectMethod(e *Env, obj Object, method MethodID, args ...Value) (Object, error)

func CallStaticObjectMethod

func CallStaticObjectMethod(e *Env, cls Class, method MethodID, args ...Value) (Object, error)

func ClassLoaderFor

func ClassLoaderFor(e *Env, obj Object) Object

ClassLoader returns a reference to the Java ClassLoader associated with obj.

func NewGlobalRef

func NewGlobalRef(e *Env, obj Object) Object

type ObjectArray

type ObjectArray C.jobjectArray

type String

type String C.jstring

func JavaString

func JavaString(e *Env, str string) String

JavaString converts the string to a JVM jstring.

type Value

type Value uint64 // All JNI types fit into 64-bits.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL