Message8685
>>> 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 http://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html#wrap(byte[],%20int,%20int), which is a very common pattern in Java, but this seems difficult :) |
|
Date |
User |
Action |
Args |
2014-06-18 23:44:39 | zyasoft | set | recipients:
+ zyasoft |
2014-06-18 23:44:39 | zyasoft | set | messageid: <1403135079.31.0.32472550334.issue2169@psf.upfronthosting.co.za> |
2014-06-18 23:44:39 | zyasoft | link | issue2169 messages |
2014-06-18 23:44:38 | zyasoft | create | |
|