I have following code in c# and need similar functionality in java using JNA:
IntPtr pImage = SerializeByteArrayToIntPtr(imageData);
public static IntPtr SerializeByteArrayToIntPtr(byte[] arr)
{
IntPtr ptr = IntPtr.Zero;
if (arr != null && arr.Length > 0)
{
ptr = Marshal.AllocHGlobal(arr.Length);
Marshal.Copy(arr, 0, ptr, arr.Length);
}
return ptr;
}
bytean unsigned 8-bit integer? It is equivalent to C 8-bitunsigned char. But, Javabyteis a 8-bit signed two's complement integer. So, it doesn't match. Probably need toc & 0xFF. For preserving C# reference-type integer parameter, useIntByReferenceorByteByReference. More helpful post at stackoverflow.com/questions/333151/…