>>> 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 :)