コード例 #1
0
 public static long Now()
 {
     if (id_now == IntPtr.Zero)
     {
         id_now = JNIEnv.GetStaticMethodID(class_ref, "now", "()J");
     }
     return(JNIEnv.CallStaticLongMethod(class_ref, id_now));
 }
コード例 #2
0
 public static long DecodeZigZag64(long p0)
 {
     if (id_decodeZigZag64_J == IntPtr.Zero)
     {
         id_decodeZigZag64_J = JNIEnv.GetStaticMethodID(class_ref, "decodeZigZag64", "(J)J");
     }
     return(JNIEnv.CallStaticLongMethod(class_ref, id_decodeZigZag64_J, new JValue(p0)));
 }
 public static unsafe long CreateRequestId()
 {
     if (id_createRequestId == IntPtr.Zero)
     {
         id_createRequestId = JNIEnv.GetStaticMethodID(class_ref, "createRequestId", "()J");
     }
     try {
         return(JNIEnv.CallStaticLongMethod(class_ref, id_createRequestId));
     } finally {
     }
 }
 public static unsafe long InitConn()
 {
     if (id_InitConn == IntPtr.Zero)
     {
         id_InitConn = JNIEnv.GetStaticMethodID(class_ref, "InitConn", "()J");
     }
     try {
         return(JNIEnv.CallStaticLongMethod(class_ref, id_InitConn));
     } finally {
     }
 }
コード例 #5
0
 public static unsafe long GetLogTime()
 {
     if (id_getLogTime == IntPtr.Zero)
     {
         id_getLogTime = JNIEnv.GetStaticMethodID(class_ref, "getLogTime", "()J");
     }
     try {
         return(JNIEnv.CallStaticLongMethod(class_ref, id_getLogTime));
     } finally {
     }
 }
 public static unsafe long GetUniqueID()
 {
     if (id_getUniqueID == IntPtr.Zero)
     {
         id_getUniqueID = JNIEnv.GetStaticMethodID(class_ref, "getUniqueID", "()J");
     }
     try {
         return(JNIEnv.CallStaticLongMethod(class_ref, id_getUniqueID));
     } finally {
     }
 }
 public static unsafe long GetBeginningOfDayTime(long p0)
 {
     if (id_getBeginningOfDayTime_J == IntPtr.Zero)
     {
         id_getBeginningOfDayTime_J = JNIEnv.GetStaticMethodID(class_ref, "getBeginningOfDayTime", "(J)J");
     }
     try {
         JValue *__args = stackalloc JValue [1];
         __args [0] = new JValue(p0);
         return(JNIEnv.CallStaticLongMethod(class_ref, id_getBeginningOfDayTime_J, __args));
     } finally {
     }
 }
 public static unsafe long B2iu(sbyte p0)
 {
     if (id_b2iu_B == IntPtr.Zero)
     {
         id_b2iu_B = JNIEnv.GetStaticMethodID(class_ref, "b2iu", "(B)J");
     }
     try {
         JValue *__args = stackalloc JValue [1];
         __args [0] = new JValue(p0);
         return(JNIEnv.CallStaticLongMethod(class_ref, id_b2iu_B, __args));
     } finally {
     }
 }
 public static unsafe long SwapLong(long p0)
 {
     if (id_swapLong_J == IntPtr.Zero)
     {
         id_swapLong_J = JNIEnv.GetStaticMethodID(class_ref, "swapLong", "(J)J");
     }
     try {
         JValue *__args = stackalloc JValue [1];
         __args [0] = new JValue(p0);
         return(JNIEnv.CallStaticLongMethod(class_ref, id_swapLong_J, __args));
     } finally {
     }
 }
コード例 #10
0
 public static unsafe long FromMovTime(int p0)
 {
     if (id_fromMovTime_I == IntPtr.Zero)
     {
         id_fromMovTime_I = JNIEnv.GetStaticMethodID(class_ref, "fromMovTime", "(I)J");
     }
     try {
         JValue *__args = stackalloc JValue [1];
         __args [0] = new JValue(p0);
         return(JNIEnv.CallStaticLongMethod(class_ref, id_fromMovTime_I, __args));
     } finally {
     }
 }
コード例 #11
0
 public static unsafe long GetTime(global::Android.Content.Context p0)
 {
     if (id_getTime_Landroid_content_Context_ == IntPtr.Zero)
     {
         id_getTime_Landroid_content_Context_ = JNIEnv.GetStaticMethodID(class_ref, "getTime", "(Landroid/content/Context;)J");
     }
     try {
         JValue *__args = stackalloc JValue [1];
         __args [0] = new JValue(p0);
         long __ret = JNIEnv.CallStaticLongMethod(class_ref, id_getTime_Landroid_content_Context_, __args);
         return(__ret);
     } finally {
     }
 }
コード例 #12
0
        public static long GetAidGenTimeFromSP(global::Android.Content.Context p0, string p1, string p2)
        {
            if (id_getAidGenTimeFromSP_Landroid_content_Context_Ljava_lang_String_Ljava_lang_String_ == IntPtr.Zero)
            {
                id_getAidGenTimeFromSP_Landroid_content_Context_Ljava_lang_String_Ljava_lang_String_ = JNIEnv.GetStaticMethodID(class_ref, "getAidGenTimeFromSP", "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)J");
            }
            IntPtr native_p1 = JNIEnv.NewString(p1);
            IntPtr native_p2 = JNIEnv.NewString(p2);
            long   __ret     = JNIEnv.CallStaticLongMethod(class_ref, id_getAidGenTimeFromSP_Landroid_content_Context_Ljava_lang_String_Ljava_lang_String_, new JValue(p0), new JValue(native_p1), new JValue(native_p2));

            JNIEnv.DeleteLocalRef(native_p1);
            JNIEnv.DeleteLocalRef(native_p2);
            return(__ret);
        }
コード例 #13
0
 public static unsafe long 鷭(global::Java.IO.ByteArrayInputStream p0)
 {
     if (id_鷭_Ljava_io_ByteArrayInputStream_ == IntPtr.Zero)
     {
         id_鷭_Ljava_io_ByteArrayInputStream_ = JNIEnv.GetStaticMethodID(class_ref, "鷭", "(Ljava/io/ByteArrayInputStream;)J");
     }
     try {
         JValue *__args = stackalloc JValue [1];
         __args [0] = new JValue(p0);
         long __ret = JNIEnv.CallStaticLongMethod(class_ref, id_鷭_Ljava_io_ByteArrayInputStream_, __args);
         return(__ret);
     } finally {
     }
 }
コード例 #14
0
        public static long Copy(global::System.IO.Stream @in, global::System.IO.Stream @out)
        {
            if (id_copy_Ljava_io_InputStream_Ljava_io_OutputStream_ == IntPtr.Zero)
            {
                id_copy_Ljava_io_InputStream_Ljava_io_OutputStream_ = JNIEnv.GetStaticMethodID(class_ref, "copy", "(Ljava/io/InputStream;Ljava/io/OutputStream;)J");
            }
            IntPtr native__in  = global::Android.Runtime.InputStreamAdapter.ToLocalJniHandle(@in);
            IntPtr native__out = global::Android.Runtime.OutputStreamAdapter.ToLocalJniHandle(@out);
            long   __ret       = JNIEnv.CallStaticLongMethod(class_ref, id_copy_Ljava_io_InputStream_Ljava_io_OutputStream_, new JValue(native__in), new JValue(native__out));

            JNIEnv.DeleteLocalRef(native__in);
            JNIEnv.DeleteLocalRef(native__out);
            return(__ret);
        }
 protected static unsafe long GetBroadcastIdentifierFromIntent(global::Android.Content.Intent p0)
 {
     if (id_getBroadcastIdentifierFromIntent_Landroid_content_Intent_ == IntPtr.Zero)
     {
         id_getBroadcastIdentifierFromIntent_Landroid_content_Intent_ = JNIEnv.GetStaticMethodID(class_ref, "getBroadcastIdentifierFromIntent", "(Landroid/content/Intent;)J");
     }
     try {
         JValue *__args = stackalloc JValue [1];
         __args [0] = new JValue(p0);
         long __ret = JNIEnv.CallStaticLongMethod(class_ref, id_getBroadcastIdentifierFromIntent_Landroid_content_Intent_, __args);
         return(__ret);
     } finally {
     }
 }
コード例 #16
0
 public static unsafe long DecodeLength(global::Java.Nio.ByteBuffer p0)
 {
     if (id_decodeLength_Ljava_nio_ByteBuffer_ == IntPtr.Zero)
     {
         id_decodeLength_Ljava_nio_ByteBuffer_ = JNIEnv.GetStaticMethodID(class_ref, "decodeLength", "(Ljava/nio/ByteBuffer;)J");
     }
     try {
         JValue *__args = stackalloc JValue [1];
         __args [0] = new JValue(p0);
         long __ret = JNIEnv.CallStaticLongMethod(class_ref, id_decodeLength_Ljava_nio_ByteBuffer_, __args);
         return(__ret);
     } finally {
     }
 }
コード例 #17
0
 public static unsafe long DaysBetween(global::Java.Util.Date p0, global::Java.Util.Date p1)
 {
     if (id_daysBetween_Ljava_util_Date_Ljava_util_Date_ == IntPtr.Zero)
     {
         id_daysBetween_Ljava_util_Date_Ljava_util_Date_ = JNIEnv.GetStaticMethodID(class_ref, "daysBetween", "(Ljava/util/Date;Ljava/util/Date;)J");
     }
     try {
         JValue *__args = stackalloc JValue [2];
         __args [0] = new JValue(p0);
         __args [1] = new JValue(p1);
         long __ret = JNIEnv.CallStaticLongMethod(class_ref, id_daysBetween_Ljava_util_Date_Ljava_util_Date_, __args);
         return(__ret);
     } finally {
     }
 }
コード例 #18
0
 public static unsafe long GetUpgradeCheckIntervalInSeconds(global::Android.Content.Context p0, long p1)
 {
     if (id_getUpgradeCheckIntervalInSeconds_Landroid_content_Context_J == IntPtr.Zero)
     {
         id_getUpgradeCheckIntervalInSeconds_Landroid_content_Context_J = JNIEnv.GetStaticMethodID(class_ref, "getUpgradeCheckIntervalInSeconds", "(Landroid/content/Context;J)J");
     }
     try {
         JValue *__args = stackalloc JValue [2];
         __args [0] = new JValue(p0);
         __args [1] = new JValue(p1);
         long __ret = JNIEnv.CallStaticLongMethod(class_ref, id_getUpgradeCheckIntervalInSeconds_Landroid_content_Context_J, __args);
         return(__ret);
     } finally {
     }
 }
コード例 #19
0
        public static unsafe long Parse(string p0)
        {
            if (id_parse_Ljava_lang_String_ == IntPtr.Zero)
            {
                id_parse_Ljava_lang_String_ = JNIEnv.GetStaticMethodID(class_ref, "parse", "(Ljava/lang/String;)J");
            }
            IntPtr native_p0 = JNIEnv.NewString(p0);

            try {
                JValue *__args = stackalloc JValue [1];
                __args [0] = new JValue(native_p0);
                long __ret = JNIEnv.CallStaticLongMethod(class_ref, id_parse_Ljava_lang_String_, __args);
                return(__ret);
            } finally {
                JNIEnv.DeleteLocalRef(native_p0);
            }
        }
コード例 #20
0
        public static unsafe long ReadLong(global::System.IO.Stream p0)
        {
            if (id_readLong_Ljava_io_InputStream_ == IntPtr.Zero)
            {
                id_readLong_Ljava_io_InputStream_ = JNIEnv.GetStaticMethodID(class_ref, "readLong", "(Ljava/io/InputStream;)J");
            }
            IntPtr native_p0 = global::Android.Runtime.InputStreamAdapter.ToLocalJniHandle(p0);

            try {
                JValue *__args = stackalloc JValue [1];
                __args [0] = new JValue(native_p0);
                long __ret = JNIEnv.CallStaticLongMethod(class_ref, id_readLong_Ljava_io_InputStream_, __args);
                return(__ret);
            } finally {
                JNIEnv.DeleteLocalRef(native_p0);
            }
        }
コード例 #21
0
        public static unsafe long GetLong(global::Android.Content.Context p0, string p1)
        {
            if (id_getLong_Landroid_content_Context_Ljava_lang_String_ == IntPtr.Zero)
            {
                id_getLong_Landroid_content_Context_Ljava_lang_String_ = JNIEnv.GetStaticMethodID(class_ref, "getLong", "(Landroid/content/Context;Ljava/lang/String;)J");
            }
            IntPtr native_p1 = JNIEnv.NewString(p1);

            try {
                JValue *__args = stackalloc JValue [2];
                __args [0] = new JValue(p0);
                __args [1] = new JValue(native_p1);
                long __ret = JNIEnv.CallStaticLongMethod(class_ref, id_getLong_Landroid_content_Context_Ljava_lang_String_, __args);
                return(__ret);
            } finally {
                JNIEnv.DeleteLocalRef(native_p1);
            }
        }
コード例 #22
0
        public static unsafe long LoadNativeRemoteLibrary(global::Android.Content.Context context, string remotePackageName, string libraryName)
        {
            if (id_loadNativeRemoteLibrary_Landroid_content_Context_Ljava_lang_String_Ljava_lang_String_ == IntPtr.Zero)
            {
                id_loadNativeRemoteLibrary_Landroid_content_Context_Ljava_lang_String_Ljava_lang_String_ = JNIEnv.GetStaticMethodID(class_ref, "loadNativeRemoteLibrary", "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)J");
            }
            IntPtr native_remotePackageName = JNIEnv.NewString(remotePackageName);
            IntPtr native_libraryName       = JNIEnv.NewString(libraryName);

            try {
                JValue *__args = stackalloc JValue [3];
                __args [0] = new JValue(context);
                __args [1] = new JValue(native_remotePackageName);
                __args [2] = new JValue(native_libraryName);
                long __ret = JNIEnv.CallStaticLongMethod(class_ref, id_loadNativeRemoteLibrary_Landroid_content_Context_Ljava_lang_String_Ljava_lang_String_, __args);
                return(__ret);
            } finally {
                JNIEnv.DeleteLocalRef(native_remotePackageName);
                JNIEnv.DeleteLocalRef(native_libraryName);
            }
        }
コード例 #23
0
        public static unsafe long CopyInputStreamToOutputStream(global::System.IO.Stream p0, global::System.IO.Stream p1, int p2, long p3)
        {
            if (id_copyInputStreamToOutputStream_Ljava_io_InputStream_Ljava_io_OutputStream_IJ == IntPtr.Zero)
            {
                id_copyInputStreamToOutputStream_Ljava_io_InputStream_Ljava_io_OutputStream_IJ = JNIEnv.GetStaticMethodID(class_ref, "copyInputStreamToOutputStream", "(Ljava/io/InputStream;Ljava/io/OutputStream;IJ)J");
            }
            IntPtr native_p0 = global::Android.Runtime.InputStreamAdapter.ToLocalJniHandle(p0);
            IntPtr native_p1 = global::Android.Runtime.OutputStreamAdapter.ToLocalJniHandle(p1);

            try {
                JValue *__args = stackalloc JValue [4];
                __args [0] = new JValue(native_p0);
                __args [1] = new JValue(native_p1);
                __args [2] = new JValue(p2);
                __args [3] = new JValue(p3);
                long __ret = JNIEnv.CallStaticLongMethod(class_ref, id_copyInputStreamToOutputStream_Ljava_io_InputStream_Ljava_io_OutputStream_IJ, __args);
                return(__ret);
            } finally {
                JNIEnv.DeleteLocalRef(native_p0);
                JNIEnv.DeleteLocalRef(native_p1);
            }
        }
コード例 #24
0
        //CJW
        public T CallMethod <T>(IntPtr methodId, bool bIsStaticMethod, String sig, List <object> param)
        {
            try
            {
                if (typeof(T) == typeof(byte))
                {
                    // Call the byte method
                    byte res;
                    if (bIsStaticMethod)
                    {
                        res = env.CallStaticByteMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        res = env.CallByteMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(bool))
                {
                    // Call the boolean method
                    bool res;
                    if (bIsStaticMethod)
                    {
                        res = env.CallStaticBooleanMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        res = env.CallBooleanMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    return((T)(object)res);
                }
                if (typeof(T) == typeof(char))
                {
                    // Call the char method
                    char res;
                    if (bIsStaticMethod)
                    {
                        res = env.CallStaticCharMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        res = env.CallCharMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(short))
                {
                    // Call the short method
                    short res;
                    if (bIsStaticMethod)
                    {
                        res = env.CallStaticShortMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        res = env.CallShortMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(int))
                {
                    // Call the int method
                    int res;
                    if (bIsStaticMethod)
                    {
                        res = env.CallStaticIntMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        res = env.CallIntMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(long))
                {
                    // Call the long method
                    long res;
                    if (bIsStaticMethod)
                    {
                        res = env.CallStaticLongMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        res = env.CallLongMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(float))
                {
                    // Call the float method
                    float res;
                    if (bIsStaticMethod)
                    {
                        res = env.CallStaticFloatMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        res = env.CallFloatMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(double))
                {
                    // Call the double method
                    double res;
                    if (bIsStaticMethod)
                    {
                        res = env.CallStaticDoubleMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        res = env.CallDoubleMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    return((T)(object)res); // need to fix this
                }
                else if (typeof(T) == typeof(string))
                {
                    // Call the string method
                    IntPtr jstr;
                    if (bIsStaticMethod)
                    {
                        jstr = env.CallStaticObjectMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        jstr = env.CallObjectMethod(javaObject, methodId, ParseParameters(sig, param));
                    }

                    string res = env.JStringToString(jstr);
                    env.DeleteLocalRef(jstr);
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(byte[]))
                {
                    // Call the byte method
                    IntPtr jobj;
                    if (bIsStaticMethod)
                    {
                        jobj = env.CallStaticObjectMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        jobj = env.CallObjectMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    if (jobj == IntPtr.Zero)
                    {
                        return(default(T));
                    }
                    byte[] res = env.JStringToByte(jobj);
                    env.DeleteLocalRef(jobj);
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(string[]))
                {
                    // Call the string array method
                    IntPtr jobj;
                    if (bIsStaticMethod)
                    {
                        jobj = env.CallStaticObjectMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        jobj = env.CallObjectMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    if (jobj == IntPtr.Zero)
                    {
                        return(default(T));
                    }

                    IntPtr[] objArray = env.GetObjectArray(jobj);
                    string[] res      = new string[objArray.Length];

                    for (int i = 0; i < objArray.Length; i++)
                    {
                        res[i] = env.JStringToString(objArray[i]);
                    }

                    env.DeleteLocalRef(jobj);
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(int[]))
                {
                    // Call the int array method
                    IntPtr jobj;
                    if (bIsStaticMethod)
                    {
                        jobj = env.CallStaticObjectMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        jobj = env.CallObjectMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    if (jobj == IntPtr.Zero)
                    {
                        return(default(T));
                    }
                    int[] res = env.GetIntArray(jobj);
                    env.DeleteLocalRef(jobj);
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(IntPtr))
                {
                    // Call the object method and deal with whatever comes back in the call code
                    IntPtr res;
                    if (bIsStaticMethod)
                    {
                        res = env.CallStaticObjectMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    else
                    {
                        res = env.CallObjectMethod(javaObject, methodId, ParseParameters(sig, param));
                    }
                    return((T)(object)res);
                }
                return(default(T));
            }
            catch (Exception e)
            {
                throw new Exception("JNICode Error:" + e.Message);
            }
        }
コード例 #25
0
ファイル: JavaLangSystem.cs プロジェクト: Paludan/BeerRun
 public static long NanoTime()
 {
     return(JNIEnv.CallStaticLongMethod(class_ref, id_nanoTime));
 }