Author zyasoft
Recipients zyasoft
Date 2014-06-18.23:44:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
>>> from java.nio import ByteBuffer
>>> x = memoryview("foobar")
>>> ByteBuffer.wrap(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: wrap(): 1st arg can't be coerced to byte[]

This is also true of buffer.

The underlying problem appears to be a lack of a __tojava__ method in PyMemoryView/Py2KBuffer that will return the desired byte[] object. For contiguous/complete arrays, this should not require a copy.

It would be interesting if we could somehow support a method like[],%20int,%20int), which is a very common pattern in Java, but this seems difficult :)
Date User Action Args
2014-06-18 23:44:39zyasoftsetrecipients: + zyasoft
2014-06-18 23:44:39zyasoftsetmessageid: <>
2014-06-18 23:44:39zyasoftlinkissue2169 messages
2014-06-18 23:44:38zyasoftcreate