The ByteBuffer returned by Pointer.getByteBuffer (as well as that
returned by ByteBuffer.allocateDirect()) gives you a DirectByteBuffer,
which derives from MappedByteBuffer, so casting should work, although
you should probably check the type to be sure before casting, since
all VMs may not have the same implementation.
Whether casting is actually the right thing to do is a different
question...
On Jun 20, 2009, at 7:39 PM, Stas Oskin wrote:
Hi.
Because the library I use accepts only the MappedByteBuffer type.
Regards.
2009/6/20 Timothy Wall <twal...@dev.java.net>
On Jun 20, 2009, at 2:41 PM, Stas Oskin wrote:
Hi.
I'm using shared memory, and I need to provide pointer to shared
memory segment in form of MappedByteBuffer.
Would typecasting ByteBuffer object to MappedByteBuffer do the trick?
The ByteBuffer you get from Pointer.getByteBuffer() is not a
MappedByteBuffer, it is a direct ByteBuffer.
Do you already have the shared memory pointer? Why do you need a
MappedByteBuffer type?
Thanks in advance!
2009/6/18 Timothy Wall <twal...@dev.java.net>
You can get a ByteBuffer from the Pointer via getDirectByteBuffer.
What are you trying to do?
On Jun 17, 2009, at 7:20 PM, Stas Oskin wrote:
Hi.
Is there any good way to get a MappedByteBuffer from Pointer?
Thanks in advance!