3 messages in net.java.dev.jna.users[jna-users] Converting byte[] to Stru...
FromSent OnAttachments
Kunal ShahOct 24, 2008 8:06 am 
Timothy WallOct 24, 2008 11:48 am 
Kunal ShahOct 24, 2008 1:18 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[jna-users] Converting byte[] to Structure ReferenceActions...
From:Kunal Shah (kuna@gmail.com)
Date:Oct 24, 2008 8:06:44 am
List:net.java.dev.jna.users

I am receiving a byte[] which is essentially a Structure reference.

In C: char *data = new char[allocLength]; ... update data ... MESSAGE *rec = (MESSAGE *)data;

printf("status: %d\n", rec->status);

Where MESSAGE is a simple structure.

In Java: byte[] data = new byte[allocLength]; ... update data ... Now what: How can I convert a "byte[]" into "MessageStructure.ByReference". And then how to read data out of it? I would appreciate actual code.

I am open for other options where I can use other than byte[] .... ByteBuffer or Memory

Thanks, Kunal