示例#1
0
        public jvmtiError GetSystemProperty(string name, out string value)
        {
            value = null;

            using (ModifiedUTF8StringData property = new ModifiedUTF8StringData(name))
            {
                IntPtr     valuePtr;
                jvmtiError error = RawInterface.GetSystemProperty(this, property, out valuePtr);
                if (error != jvmtiError.None)
                {
                    return(error);
                }

                unsafe
                {
                    if (valuePtr != IntPtr.Zero)
                    {
                        value = ModifiedUTF8Encoding.GetString((byte *)valuePtr);
                        Deallocate(valuePtr);
                    }
                }

                return(jvmtiError.None);
            }
        }
示例#2
0
        public jvmtiError GetSystemProperty(string name, out string value)
        {
            value = null;

            using (ModifiedUTF8StringData property = new ModifiedUTF8StringData(name))
            {
                IntPtr valuePtr;
                jvmtiError error = RawInterface.GetSystemProperty(this, property, out valuePtr);
                if (error != jvmtiError.None)
                    return error;

                unsafe
                {
                    if (valuePtr != IntPtr.Zero)
                    {
                        value = ModifiedUTF8Encoding.GetString((byte*)valuePtr);
                        Deallocate(valuePtr);
                    }
                }

                return jvmtiError.None;
            }
        }