My client gave me dll with a couple of functions. Two of them are as follows:
int getText(void* page, wchar_t*& pTextOut);
int getTextJson(void* page, char*& jsonData);
I am using JNA and I am tring to write equivalent Java method in my interface:
int getText(Pointer pdfPage, ?? textOutput);
int getTextJson(Pointer pdfPage, ?? jsonData);
Unfortunately the following returns garbage
Pointer outputTextPointer = outputText.getPointer();
String outputStre = outputTextPointer.getString(0, "UTF-8");
The following returns and IndexOutOfBoundsException
Pointer outputTextPointer = outputText.getPointer();
String outputStre = outputTextPointer.getStringArray(0);
Can anyone recommend the correct java class to use to map the types wchar_t*& and char*& or how to get at the data correctly?
Thanks Damien
The following mappings work correctly for me
int getText(Pointer page, PointerByReference pTextOut);
int getTextJson(Pointer page, PointerByReference jsonData);
And then I use the following to get the data
PointerByReference pTextOut = new PointerByReference();
getText(page, pTextOut);
System.out.println(pTextOut.getValue().getWideString(0));