15 messages in net.java.dev.jna.users[jna-users] Non-direct Buffer is not ...
FromSent OnAttachments
Drayton BrownMar 11, 2009 9:22 am 
Daniel KaufmannMar 11, 2009 6:59 pm 
Drayton BrownMar 12, 2009 5:33 am 
Daniel KaufmannMar 12, 2009 3:05 pm 
Drayton BrownMar 13, 2009 3:28 am 
Drayton BrownMar 20, 2009 2:55 am 
Drayton BrownMar 20, 2009 4:09 am 
Timothy WallMar 20, 2009 6:03 am 
Drayton BrownMar 20, 2009 7:28 am 
Drayton BrownMar 20, 2009 8:42 am 
Timothy WallMar 20, 2009 9:25 am 
Drayton BrownMar 20, 2009 2:22 pm 
Drayton BrownMar 23, 2009 9:25 am 
Timothy WallMar 23, 2009 11:10 am 
DraytonMar 23, 2009 11:47 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:[jna-users] Non-direct Buffer is not supported?Actions...
From:Drayton Brown (dray@gmail.com)
Date:Mar 11, 2009 9:22:02 am
List:net.java.dev.jna.users

Hello all...

I've been working on trying to access a linux shared object from java for the last two weeks. Its my first time using JNA, and its been a reletively good experience. I believe that once I've solved this final problem, I will have completed the task I'm trying to do. As things are becoming quite urgent I would greatly appreciate a timely response.

*This is the structure I'm having problems with: *

typedef struct {

...

/** Pointer to the first scan line of the image. In case of planar format it is a pointer to an array of pointers to separate planes. */ void* Data;

...

} RE_IMAGE; * I've coded this as follows:*

public interface RedEye extends Library {

public static class RE_IMAGE extends Structure {

...

public Pointer data;

...

}

} * And I'm using it like this:*

RedEye.RE_IMAGE reImage = new RedEye.RE_IMAGE();

... //We have to pass in a pointer to the data... ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ImageIO.write(image_input, "jpg", byteArrayOutputStream); byte[] bytes = byteArrayOutputStream.toByteArray(); ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); Buffer buffer = (Buffer) byteBuffer; reImage.data = Native.getDirectBufferPointer(buffer); ... * Unfortunately this is throwing the following exception:*

Exception in thread "main" java.lang.IllegalArgumentException: Non-direct Buffer is not supported at com.sun.jna.Native.getDirectBufferPointer(Native Method) at jredeye.Main.main(Main.java:60)

If any further detail is required, please feel free to ask. Any help or input on this would be greatly appreciated.

Regards Drayton