Is there any equivalent to Marshal in c# to Java?

237 views Asked by At

Is there any Native Android Java/Kotlin equivalent to C#'s IntPtr and Marshall?

IntPtr unmanagedMemory = Marshal.AllocHGlobal(length);
Marshal.Copy(source, sourceIndex, unmanagedMemory, length);
object returnValue = Marshal.PtrToStructure(unmanagedMemory, destinationType);
Marshal.FreeHGlobal(unmanagedMemory);
1

There are 1 answers

0
Ravilatha On

There is no possible way to do this with Android. Even in my personal experience I tried with sun.misc.Unsafe, but that does not even helped me.