Hello,

due to compatibility reasons, I need to be able to store a random C buffer inside of a Java String. THis means that the Java String should contain the exact same buffer information (i.e. byte sequence) as the original C buffer. How would I do that?

All the functions I found will always somehow code/decode the C buffer, and modify its content depending on the selected encoding.

I need to doo this inside JNI. Following is what I have:

	unsigned char* cBuffer=getCBuffer();
 
	// Transfer the C buffer to s:
	jstring s=NULL;
   	if (env->EnsureLocalCapacity(2) >= 0)
	{
		jbyteArray bytes = env->NewByteArray(signalLength);
		if (bytes != NULL) 
		{
			env->SetByteArrayRegion(bytes, 0, signalLength,(jbyte *)cBuffer);
			jclass cls = env->FindClass("java/lang/String");
			jmethodID mid = env->GetMethodID(cls, "<init>", "([B)V");
			s = (jstring)env->NewObject(cls, mid, bytes);
			env->DeleteLocalRef(bytes);
		}
	}

Thanks for any help