示例#1
0
        public byte CallByteMethod(JavaObject obj, MethodId methodIdNative, params Value[] args)
        {
            byte res = callByteMethod(envPtr, obj.JvmHandle, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
示例#2
0
        public double CallDoubleMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
        {
            double res = callDoubleMethod(envPtr, obj, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
示例#3
0
        public short CallShortMethod(JavaObject obj, MethodId methodIdNative, params Value[] args)
        {
            short res = callShortMethod(envPtr, obj.JvmHandle, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
示例#4
0
        public long CallLongMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
        {
            long res = callLongMethod(envPtr, obj, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
示例#5
0
        public char CallCharMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
        {
            var res = (char)callCharMethod(envPtr, obj, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
示例#6
0
        public bool CallBooleanMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
        {
            bool res = callBooleanMethod(envPtr, obj, methodIdNative.native, args) != 0;

            ExceptionTest();
            return(res);
        }
示例#7
0
        public float CallNonVirtualFloatMethod(JavaObject obj, JniHandle clazz, MethodId methodIdNative, params Value[] args)
        {
            var res = callNonvirtualFloatMethod(envPtr, obj.JvmHandle, clazz, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
示例#8
0
        public double CallNonVirtualDoubleMethod(JniHandle obj, JniHandle clazz, MethodId methodIdNative, params Value[] args)
        {
            var res = callNonvirtualDoubleMethod(envPtr, obj, clazz, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
示例#9
0
        public byte CallStaticByteMethod(JniHandle clazz, MethodId methodIdNative, params Value[] args)
        {
            byte res = callStaticByteMethod(envPtr, clazz, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
示例#10
0
        public JniLocalHandle CallStaticObjectMethod(JniHandle clazz, MethodId methodIdNative, params Value[] args)
        {
            JniLocalHandle res = callStaticObjectMethod(envPtr, clazz, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
示例#11
0
        public short CallStaticShortMethod(JniHandle clazz, MethodId methodIdNative, params Value[] args)
        {
            short res = callStaticShortMethod(envPtr, clazz, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
示例#12
0
        public float CallFloatMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
        {
            float res = callFloatMethod(envPtr, obj, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
示例#13
0
        public JniLocalHandle NewObject(JniHandle clazz, MethodId methodID, params Value[] args)
        {
            JniLocalHandle res = newObject(envPtr, clazz, methodID.native, args);

            ExceptionTest();
            return(res);
        }
示例#14
0
        public JniLocalHandle ToReflectedMethod(JniHandle cls, MethodId methodId, bool isStatic)
        {
            JniLocalHandle res = toReflectedMethod.Invoke(envPtr, cls, methodId.native,
                                                          isStatic ? (byte)1 : (byte)0);

            ExceptionTest();
            return(res);
        }
示例#15
0
 private static void InitializeClassMethods(JNIEnv env)
 {
     if (!mHasInitializedClassMethods)
     {
         JniLocalHandle classClass = env.FindClass("java/lang/Class");
         mGetName                    = env.GetMethodID(classClass, "getName", "()Ljava/lang/String;");
         mGetCanonicalName           = env.GetMethodID(classClass, "getCanonicalName", "()Ljava/lang/String;");
         mGetSuperclass              = env.GetMethodID(classClass, "getSuperclass", "()Ljava/lang/Class;");
         mHasInitializedClassMethods = true;
     }
 }
示例#16
0
        public JavaVM(IntPtr native)
        {
            if (defaultVM != null)
                throw new Exception("Why is a second VM being initialized?");
            this.native = native;
            defaultVM = this;
            functions = *(*(JavaPtr*) native.ToPointer()).functions;

            Helper.GetDelegateForFunctionPointer(functions.AttachCurrentThreadAsDaemon, ref attachCurrentThreadAsDaemon);
            Helper.GetDelegateForFunctionPointer(functions.AttachCurrentThread, ref attachCurrentThread);
            Helper.GetDelegateForFunctionPointer(functions.DestroyJavaVM, ref destroyJavaVM);
            Helper.GetDelegateForFunctionPointer(functions.DetachCurrentThread, ref detachCurrentThread);
            Helper.GetDelegateForFunctionPointer(functions.GetEnv, ref getEnv);

            var env = JNIEnv.ThreadEnv;
            var classLoaderClass = env.FindClass("java/lang/ClassLoader");
            findClass = env.GetMethodID(classLoaderClass, "findClass", "(Ljava/lang/String;)Ljava/lang/Class;");
        }
示例#17
0
 public char CallCharMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
 {
     var res = (char) callCharMethod(envPtr, obj, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
示例#18
0
 public byte CallByteMethod(JavaObject obj, MethodId methodIdNative, params Value[] args)
 {
     byte res = callByteMethod(envPtr, obj.JvmHandle, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
示例#19
0
 public JniLocalHandle NewObject(JniHandle clazz, MethodId methodID, params Value[] args)
 {
     JniLocalHandle res = newObject(envPtr, clazz, methodID.native, args);
     ExceptionTest();
     return res;
 }
示例#20
0
 public void CallNonVirtualVoidMethod(JniHandle obj, JniHandle clazz, MethodId methodIdNative, params Value[] args)
 {
     callNonvirtualVoidMethod(envPtr, obj, clazz, methodIdNative.native, args);
     ExceptionTest();
 }
示例#21
0
 public bool CallBooleanMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
 {
     bool res = callBooleanMethod(envPtr, obj, methodIdNative.native, args) != 0;
     ExceptionTest();
     return res;
 }
示例#22
0
 public JniLocalHandle ToReflectedMethod(JniHandle cls, MethodId methodId, bool isStatic)
 {
     JniLocalHandle res = toReflectedMethod.Invoke(envPtr, cls, methodId.native,
                                           isStatic ? (byte) 1 : (byte) 0);
     ExceptionTest();
     return res;
 }
示例#23
0
 public void CallStaticVoidMethod(JniHandle clazz, MethodId methodIdNative, params Value[] args)
 {
     callStaticVoidMethod(envPtr, clazz, methodIdNative.native, args);
     //TODO result could be tested in Java 1.6
     ExceptionTest();
 }
示例#24
0
 public byte CallStaticByteMethod(JniHandle clazz, MethodId methodIdNative, params Value[] args)
 {
     byte res = callStaticByteMethod(envPtr, clazz, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
示例#25
0
 public long CallStaticLongMethod(JniHandle clazz, MethodId methodIdNative, params Value[] args)
 {
     long res = callStaticLongMethod(envPtr, clazz, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
示例#26
0
 public short CallNonVirtualShortMethod(JniHandle obj, JniHandle clazz, MethodId methodIdNative, params Value[] args)
 {
     var res = callNonvirtualShortMethod(envPtr, obj, clazz, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
示例#27
0
 public void CallNonVirtualVoidMethod(JniHandle obj, JniHandle clazz, MethodId methodIdNative, params Value[] args)
 {
     callNonvirtualVoidMethod(envPtr, obj, clazz, methodIdNative.native, args);
     ExceptionTest();
 }
示例#28
0
 public IntPtr CallNonVirtualObjectMethodPtr(JavaObject obj, JniHandle clazz, MethodId methodIdNative, params Value[] args)
 {
     var res = callNonvirtualObjectMethod(envPtr, obj.JvmHandle, clazz, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
示例#29
0
        internal void CallStaticVoidMethod(JniHandle clazz, string method, string sig, params Value[] args)
        {
            MethodId idNative = GetStaticMethodID(clazz, method, sig);

            CallStaticVoidMethod(clazz, idNative, args);
        }
示例#30
0
 public int CallIntMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
 {
     int res = callIntMethod(envPtr, obj, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
示例#31
0
 public double CallDoubleMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
 {
     double res = callDoubleMethod(envPtr, obj, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
示例#32
0
 public short CallStaticShortMethod(JniHandle clazz, MethodId methodIdNative, params Value[] args)
 {
     short res = callStaticShortMethod(envPtr, clazz, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
示例#33
0
 public float CallFloatMethod(JavaObject obj, MethodId methodIdNative, params Value[] args)
 {
     float res = callFloatMethod(envPtr, obj.JvmHandle, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
示例#34
0
 public void CallStaticVoidMethod(JniHandle clazz, MethodId methodIdNative, params Value[] args)
 {
     callStaticVoidMethod(envPtr, clazz, methodIdNative.native, args);
     //TODO result could be tested in Java 1.6
     ExceptionTest();
 }
示例#35
0
 public JniLocalHandle CallStaticObjectMethod(JniHandle clazz, MethodId methodIdNative, params Value[] args)
 {
     JniLocalHandle res = callStaticObjectMethod(envPtr, clazz, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
示例#36
0
 public void CallVoidMethod(JniHandle obj, MethodId methodId, params Value[] args)
 {
     callVoidMethod(envPtr, obj, methodId.native, args);
     //TODO result could be tested in Java 1.6
     ExceptionTest();
 }
示例#37
0
 public long CallLongMethod(JavaObject obj, MethodId methodIdNative, params Value[] args)
 {
     long res = callLongMethod(envPtr, obj.JvmHandle, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
示例#38
0
 public void CallVoidMethod(JniHandle obj, MethodId methodId, params Value[] args)
 {
     callVoidMethod(envPtr, obj, methodId.native, args);
     //TODO result could be tested in Java 1.6
     ExceptionTest();
 }