wcslen (w_buffer)); // Deep Copy, in usual case we only need Shallow Copy as we just need this class to provide some convenience for handling jstring
mChars = new char[wcslen (w_buffer) * 2 + 1];
WideCharToMultiByte (CP_ACP, 0, w_buffer, wcslen (w_buffer) + 1, mChars, wcslen (w_buffer) * 2 + 1,
NULL, NULL);
env->ReleaseStringChars (str, w_buffer);
mString = mChars;
}
// Create a new instance from the specified string
JNIString(JNIEnv* env, const string& str) :
mEnv (env) {
int slen = str.length ();
jchar* buffer = new jchar[slen];
int len = MultiByteToWideChar (CP_ACP, 0, str.c_str (), str.length (), buffer, slen);