예제 #1
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public double CallDoubleMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
        {
            double res = callDoubleMethod(envPtr, obj, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
예제 #2
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public bool CallBooleanMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
        {
            bool res = callBooleanMethod(envPtr, obj, methodIdNative.native, args) != 0;

            ExceptionTest();
            return(res);
        }
예제 #3
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public long CallLongMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
        {
            long res = callLongMethod(envPtr, obj, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
예제 #4
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public char CallCharMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
        {
            var res = (char)callCharMethod(envPtr, obj, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
예제 #5
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public void NewObject(Class clazz, MethodId methodID, IJvmProxy obj, params Value[] args)
        {
            JniLocalHandle res = newObject(envPtr, clazz.jvmHandle, methodID.native, args);

            ExceptionTest();
            obj.Init(this, res);
        }
예제 #6
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public IObject NewObject(Class clazz, MethodId methodID, params Value[] args)
        {
            JniLocalHandle res = newObject(envPtr, clazz.jvmHandle, methodID.native, args);

            ExceptionTest();
            return(Convertor.FullJ2C <IJvmProxy>(this, res));
        }
예제 #7
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public JniLocalHandle NewObjectPtr(JniHandle clazz, MethodId methodID, params Value[] args)
        {
            JniLocalHandle res = newObject(envPtr, clazz, methodID.native, args);

            ExceptionTest();
            return(res);
        }
예제 #8
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public float CallFloatMethod(JniHandle obj, MethodId methodIdNative, params Value[] args)
        {
            float res = callFloatMethod(envPtr, obj, methodIdNative.native, args);

            ExceptionTest();
            return(res);
        }
예제 #9
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public Method ToReflectedMethod(Class cls, MethodId methodId, bool isStatic)
        {
            JniLocalHandle res = toReflectedMethod.Invoke(envPtr, cls.jvmHandle, methodId.native,
                                                          isStatic ? (byte)1 : (byte)0);

            ExceptionTest();
            return(Convertor.StrongJ2Cp <Method>(this, res));
        }
예제 #10
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        private TRes CallStaticMethod <TRes>(Class clazz, string method, string sig, params Value[] args)
        {
            MethodId idNative = GetStaticMethodID(clazz, method, sig);

            if (idNative != null)
            {
                if (typeof(IObject).IsAssignableFrom(typeof(TRes)) ||
                    (typeof(object) == (typeof(TRes)) ||
                     typeof(Delegate).IsAssignableFrom(typeof(TRes)))
                    )
                {
                    return(CallStaticObjectMethod <TRes>(clazz, idNative, args));
                }
                if (typeof(string).IsAssignableFrom(typeof(TRes)))
                {
                    return(CallStaticObjectMethod <TRes>(clazz, idNative, args));
                }
                if (typeof(int).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallStaticIntMethod(clazz, idNative, args));
                }
                if (typeof(bool).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallStaticBooleanMethod(clazz, idNative, args));
                }
                if (typeof(long).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallStaticLongMethod(clazz, idNative, args));
                }
                if (typeof(double).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallStaticDoubleMethod(clazz, idNative, args));
                }
                if (typeof(byte).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallStaticByteMethod(clazz, idNative, args));
                }
                if (typeof(short).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallStaticShortMethod(clazz, idNative, args));
                }
                if (typeof(float).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallStaticFloatMethod(clazz, idNative, args));
                }
                if (typeof(char).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallStaticCharMethod(clazz, idNative, args));
                }
                if (typeof(byte).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallStaticByteMethod(clazz, idNative, args));
                }
            }
            throw new ArgumentException();
        }
예제 #11
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public void CallVoidMethod(IJvmProxy obj, MethodId methodId, params Value[] args)
        {
#if DEBUG
            if (Bridge.Setup.VeryVerbose)
            {
                Console.WriteLine("IJvmProxy : " + obj.GetType().FullName);
            }
#endif
            CallVoidMethod(obj.JvmHandle, methodId, args);
        }
예제 #12
0
        public IObject NewObject(Class clazz, string method, string sig, params object[] args)
        {
            MethodId idNative = GetMethodID(clazz, method, sig);

            if (idNative != null)
            {
                return(NewObject(clazz, idNative, Convertor.ConverArgs(this, args)));
            }
            throw new ArgumentException();
        }
예제 #13
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        private TRes CallMethod <TRes>(IJvmProxy obj, string method, string sig, params Value[] args)
        {
            MethodId idNative = GetMethodID(GetObjectClass(obj), method, sig);

            if (idNative != null)
            {
                if (typeof(IObject).IsAssignableFrom(typeof(TRes)) ||
                    typeof(object) == (typeof(TRes)) ||
                    typeof(Delegate).IsAssignableFrom(typeof(TRes)))
                {
                    return(CallObjectMethod <TRes>(obj, idNative, args));
                }
                if (typeof(string).IsAssignableFrom(typeof(TRes)))
                {
                    return(CallObjectMethod <TRes>(obj, idNative, args));
                }
                if (typeof(int).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallIntMethod(obj, idNative, args));
                }
                if (typeof(bool).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallBooleanMethod(obj, idNative, args));
                }
                if (typeof(long).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallLongMethod(obj, idNative, args));
                }
                if (typeof(double).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallDoubleMethod(obj, idNative, args));
                }
                if (typeof(byte).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallByteMethod(obj, idNative, args));
                }
                if (typeof(short).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallShortMethod(obj, idNative, args));
                }
                if (typeof(float).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallFloatMethod(obj, idNative, args));
                }
                if (typeof(char).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallCharMethod(obj, idNative, args));
                }
                if (typeof(byte).IsAssignableFrom(typeof(TRes)))
                {
                    return((TRes)(object)CallByteMethod(obj, idNative, args));
                }
            }
            throw new ArgumentException();
        }
예제 #14
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        internal void CallStaticVoidMethod(Class clazz, string method, string sig, params Value[] args)
        {
            MethodId idNative = GetStaticMethodID(clazz, method, sig);

            if (idNative != null)
            {
                CallStaticVoidMethod(clazz, idNative, args);
                return;
            }
            throw new ArgumentException();
        }
예제 #15
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public byte CallStaticByteMethod(Class clazz, MethodId methodIdNative, params Value[] args)
        {
#if DEBUG
            if (Bridge.Setup.VeryVerbose)
            {
                Console.WriteLine("CallStaticByteMethod : " + clazz.FullName);
            }
#endif
            byte res = callStaticByteMethod(envPtr, clazz.jvmHandle, methodIdNative.native, args);
            ExceptionTest();
            return(res);
        }
예제 #16
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public void CallStaticVoidMethod(Class clazz, MethodId methodIdNative, params Value[] args)
        {
#if DEBUG
            if (Bridge.Setup.VeryVerbose)
            {
                Console.WriteLine("CallStaticVoidMethod : " + clazz.FullName);
            }
#endif
            callStaticVoidMethod(envPtr, clazz.jvmHandle, methodIdNative.native, args);
            //TODO result could be tested in Java 1.6
            ExceptionTest();
        }
예제 #17
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public char CallCharMethod(IJvmProxy obj, MethodId methodIdNative, params Value[] args)
        {
#if DEBUG
            if (Bridge.Setup.VeryVerbose)
            {
                Console.WriteLine("CallCharMethod : " + obj.GetType().FullName);
            }
#endif
            var res = (char)callCharMethod(envPtr, obj.JvmHandle, methodIdNative.native, args);
            ExceptionTest();
            return(res);
        }
예제 #18
0
 public JniLocalHandle CallStaticObjectMethodPtr(Class clazz, MethodId methodIdNative, params Value[] args)
 {
     #if DEBUG
     if (Bridge.Setup.VeryVerbose)
     {
         Console.WriteLine("CallStaticObjectMethodPtr : " + clazz.FullName);
     }
     #endif
     JniLocalHandle res = callStaticObjectMethod(envPtr, clazz.jvmHandle, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
예제 #19
0
파일: JNIEnv.raw.cs 프로젝트: gywerd/WinJNI
        public JniLocalHandle CallObjectMethodPtr(IJvmProxy obj, MethodId methodIdNative, params Value[] args)
        {
#if DEBUG
            if (Bridge.Setup.VeryVerbose)
            {
                Console.WriteLine("CallObjectMethodPtr : " + obj.GetType().FullName);
            }
#endif
            JniLocalHandle res = callObjectMethod(envPtr, obj.JvmHandle, methodIdNative.native, args);
            ExceptionTest();
            return(res);
        }
예제 #20
0
 public JniLocalHandle CallObjectMethodPtr(IJvmProxy obj, MethodId methodIdNative, params Value[] args)
 {
     #if DEBUG
     if (Bridge.Setup.VeryVerbose)
     {
         Console.WriteLine("CallObjectMethodPtr : " + obj.GetType().FullName);
     }
     #endif
     JniLocalHandle res = callObjectMethod(envPtr, obj.JvmHandle, methodIdNative.native, args);
     ExceptionTest();
     return res;
 }
예제 #21
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        private int CallIntMethod(IJvmProxy obj, string method, string sig, params Value[] args)
        {
            Class objectClass = GetObjectClass(obj);

            if (objectClass != null)
            {
                MethodId methodId = GetMethodID(objectClass, method, sig);
                if (methodId != null)
                {
                    return(CallIntMethod(obj, methodId, args));
                }
            }
            throw new ArgumentException();
        }
예제 #22
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public TRes CallObjectMethod <TRes>(IJvmProxy obj, MethodId methodIdNative, params Value[] args)
        {
            JniLocalHandle res = CallObjectMethodPtr(obj, methodIdNative, args);

            return(Convertor.FullJ2C <TRes>(this, res));
        }
예제 #23
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
        public TRes CallStaticObjectMethod <TRes>(Class clazz, MethodId methodIdNative, params Value[] args)
        {
            JniLocalHandle res = CallStaticObjectMethodPtr(clazz, methodIdNative, args);

            return(Convertor.FullJ2C <TRes>(this, res));
        }
예제 #24
0
        private static void Init()
        {
            if (initDone)
            {
                return;
            }
            try
            {
                initDone = true;
                // sun JVM specific
                JNIEnv env = JNIEnv.ThreadEnv;
                dbClazz = env.FindClass("java/nio/DirectByteBuffer");

                // java 7 and above
                ctor = env.GetMethodIDNoThrow(dbClazz, "<init>", "(IJLjava/io/FileDescriptor;Ljava/lang/Runnable;)V");
                if (ctor == null)
                {
                    // java 6 and below
                    ctor = env.GetMethodIDNoThrow(dbClazz, "<init>", "(IJLjava/lang/Runnable;)V");
                    jdk6 = true;
                }
            }
            catch (Exception)
            {
            }
        }
예제 #25
0
파일: JNIEnv.cs 프로젝트: cd37ycs/jni4net
 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();
 }