Sometimes you need to pass an array of bytes to a function so that the function fills the byte array with the result. In this case, sending a Python string will not work, because Python strings are immutable. Instead, create a Java byte array with the jarray module :
import jarray
bytes = jarray.zeros(100, "b")
length = zlibDeflater.deflate(bytes)
...
source
share