start writing bytebuffer with jni