Hi i have to convert a jbyteArray into jString
my
java prog is ---JniEx1.java
class JniEx1{
private native String getMessage(byte[] b,int i);
public static void main(String args[]) {
String s="Hello World";
byte[] b=s.getBytes();
JniEx1 je1 = new JniEx1();
String msg = je1.getMessage(b,60);
System.out.println("User typed: " + msg);
}
static {
System.loadLibrary("Prompt");
}
}
generated method signature in JniEx1.h is
JNIEXPORT jstring JNICALL Java_JniEx1_getMessage
(JNIEnv *, jobject, jbyteArray, jint);
now in c file ------
#include <jni.h>
#include <stdio.h>
#include "JniEx1.h"
JNIEXPORT jstring JNICALL Java_JniEx1_getMessage(JNIEnv *env, jobject obj,jbyteArray jbr, jint ji)
{
.............................................................................................................
........................................................................................................
}
What i will write in the .... area to covert jbyteArray jbr into some Jstring variable ?