first stab at a JNI encoder