I\'ve used https://stackoverflow.com/a/38769851 and adapted for C++ as follows:
jsize num_bytes = env->GetArrayLength(message); char *buffer = new