Exemple #1
0
        public void GetMethodName(JvmMethod method, out string name, out string signature, out string generic)
        {
            IntPtr namePtr;
            IntPtr signaturePtr;
            IntPtr genericPtr;

            ThrowOnFailure(_rawInterface.GetMethodName(_env, (jmethodID)method, out namePtr, out signaturePtr, out genericPtr));
            try
            {
                name      = null;
                signature = null;
                generic   = null;
                unsafe
                {
                    if (namePtr != IntPtr.Zero)
                    {
                        name = ModifiedUTF8Encoding.GetString((byte *)namePtr);
                    }
                    if (signaturePtr != IntPtr.Zero)
                    {
                        signature = ModifiedUTF8Encoding.GetString((byte *)signaturePtr);
                    }
                    if (genericPtr != IntPtr.Zero)
                    {
                        generic = ModifiedUTF8Encoding.GetString((byte *)genericPtr);
                    }
                }
            }
            finally
            {
                Deallocate(namePtr);
                Deallocate(signaturePtr);
                Deallocate(genericPtr);
            }
        }