Skip to content

Instantly share code, notes, and snippets.

@LiewJunTung
Created June 18, 2018 13:06
Show Gist options
  • Save LiewJunTung/387abf67830927874c41e5321f6b3064 to your computer and use it in GitHub Desktop.
Save LiewJunTung/387abf67830927874c41e5321f6b3064 to your computer and use it in GitHub Desktop.
namespace djinni {
struct ByteBuffer {
using CppType = int8_t *;
using JniType = jobject;
static CppType toCpp(JNIEnv* env, JniType j) {
return (int8_t *) env->GetDirectBufferAddress(j);
}
static JniType fromCpp(JNIEnv *env, CppType c) {
return env->NewDirectByteBuffer(c, sizeof(c));
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment