Java本地介面(JNI)程式設計指南和規範(第三章)
阿新 • • 發佈:2018-12-14
3.2.6 "JNI String"函式的總結(Summary of JNI String Functions)
Table 3.1摘要所有字串相關的"JNI"函式。"Java 2 SDK 1.2 release"增加一寫新的函式,來增強對某些字串操作的執行。這些增加的函式不支援新的操作,而是帶來效能的改善。
Table 3.1 Summary of JNI String Functions
JNI Function Description since
GetStringChars Obtains or release a pointer to the JDK1.1
RetleaseStringChars contents of a string in Unicode format.
May return a copy of the string.
GetStringUTFChars Obtains or release a pointer to the JDK1.1
ReleaseStringUTFChars contents of a string in UTF-8 format.
May return a copy of the string.
GetStringLength Returns the number of Unicode char- JDK1.1
acters in the string.
GetStringUTFLength Returns the number of bytes needed JDK1.1
(not including the trailing 0) to repre-
sent a string in the UTF-8 Format.
NewString Create a java.lang.String instance JDK1.1
that contains the same sequence of
characters as the given Unicode C string
NewStringUTF Create a java.lang.String instance JDK1.1
that contains the same sequence of
characters as the given UTF-8 encoded C
string.
GetStringCritical Obtains a pointer to the contents of a Java 2
ReleaseStringCritical string in Unicode format. May return a SDK1.2
copy of theh string.Native code must
not block between a pair of Get/
ReleaseStringCritical calls.
GetStringRegion Copies the content of a string to or Java 2
SetStringRegion from a preallocated C buffer in the SDK1.2
Unicode format.
GetStringUTFRegion Copies the content of a string to or Java 2
SetStringUTFRegion from a preallocated C buffer in the SDK1.2
UTF-8 format.