implement JNIEnv::NewString()

This commit is contained in:
Joel Dice 2007-10-26 15:23:54 -06:00
parent 476a0d70f2
commit 46ac6f92ee

View File

@ -102,6 +102,21 @@ ReleaseStringUTFChars(Thread* t, jstring, const char* chars)
t->m->system->free(chars); t->m->system->free(chars);
} }
jstring JNICALL
NewString(Thread* t, const jchar* chars, jsize size)
{
ENTER(t, Thread::ActiveState);
object a = 0;
if (size) {
object a = makeCharArray(t, size, false);
memcpy(&charArrayBody(t, a, 0), chars, size);
}
object s = makeString(t, a, 0, size, 0);
return makeLocalReference(t, s);
}
jstring JNICALL jstring JNICALL
NewStringUTF(Thread* t, const char* chars) NewStringUTF(Thread* t, const char* chars)
{ {
@ -1688,6 +1703,7 @@ populateJNITables(JavaVMVTable* vmTable, JNIEnvVTable* envTable)
envTable->GetStringUTFLength = ::GetStringUTFLength; envTable->GetStringUTFLength = ::GetStringUTFLength;
envTable->GetStringUTFChars = ::GetStringUTFChars; envTable->GetStringUTFChars = ::GetStringUTFChars;
envTable->ReleaseStringUTFChars = ::ReleaseStringUTFChars; envTable->ReleaseStringUTFChars = ::ReleaseStringUTFChars;
envTable->NewString = ::NewString;
envTable->NewStringUTF = ::NewStringUTF; envTable->NewStringUTF = ::NewStringUTF;
envTable->FindClass = ::FindClass; envTable->FindClass = ::FindClass;
envTable->ThrowNew = ::ThrowNew; envTable->ThrowNew = ::ThrowNew;