4 messages in net.java.dev.jna.usersRe: [jna-users] How to create a point...
FromSent OnAttachments
Christine ZimmerJan 13, 2009 2:45 am 
Nikolas LotzJan 13, 2009 5:58 am 
Christine ZimmerJan 14, 2009 11:15 pm 
Nikolas LotzJan 15, 2009 2:41 am 
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:Re: [jna-users] How to create a pointer from byte[]?Actions...
From:Nikolas Lotz (nlo@nde.ag)
Date:Jan 13, 2009 5:58:12 am
List:net.java.dev.jna.users

How can I create a Pointer from a byte array ?

try to create a new chunk of memory, fill it with your XML-data and don't forget the terminating zero-byte:

--- snip ------------------------------------------- byte[] xmlData = ...; Memory xmlBuffer = new Memory(xmlData.length + 1); xmlBuffer.write(0, xmlData, 0, xmlData.length); xmlBuffer.setByte(xmlData.length, 0); --- snap -------------------------------------------

now you can pass 'xmlBuffer' as a pointer ...

One of the parameteres of the Pointer.write(...) method is the offset ('offset - byte offset from pointer into which data is copied'). What is this offset? I don't understand the description in the javadoc.

this would be the 'destination offset' ...

Vorsitzende des Aufsichtsrates: Angelika Mozdzen Sitz und Registergericht: Hamburg, HRB 90934 Vorstand: Jens-U. Mozdzen USt-IdNr. DE 814 013 983