Last active
          August 29, 2015 14:02 
        
      - 
      
 - 
        
Save ifree/6ed8e8425358a7e0e994 to your computer and use it in GitHub Desktop.  
    #jni string functions
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // UTF-8 String (encoded to 1-3 byte, backward compatible with 7-bit ASCII) | |
| // Can be mapped to null-terminated char-array C-string | |
| const char * GetStringUTFChars(JNIEnv *env, jstring string, jboolean *isCopy); | |
| // Returns a pointer to an array of bytes representing the string in modified UTF-8 encoding. | |
| void ReleaseStringUTFChars(JNIEnv *env, jstring string, const char *utf); | |
| // Informs the VM that the native code no longer needs access to utf. | |
| jstring NewStringUTF(JNIEnv *env, const char *bytes); | |
| // Constructs a new java.lang.String object from an array of characters in modified UTF-8 encoding. | |
| jsize GetStringUTFLength(JNIEnv *env, jstring string); | |
| // Returns the length in bytes of the modified UTF-8 representation of a string. | |
| void GetStringUTFRegion(JNIEnv *env, jstring str, jsize start, jsize length, char *buf); | |
| // Translates len number of Unicode characters beginning at offset start into modified UTF-8 encoding | |
| // and place the result in the given buffer buf. | |
| // Unicode Strings (16-bit character) | |
| const jchar * GetStringChars(JNIEnv *env, jstring string, jboolean *isCopy); | |
| // Returns a pointer to the array of Unicode characters | |
| void ReleaseStringChars(JNIEnv *env, jstring string, const jchar *chars); | |
| // Informs the VM that the native code no longer needs access to chars. | |
| jstring NewString(JNIEnv *env, const jchar *unicodeChars, jsize length); | |
| // Constructs a new java.lang.String object from an array of Unicode characters. | |
| jsize GetStringLength(JNIEnv *env, jstring string); | |
| // Returns the length (the count of Unicode characters) of a Java string. | |
| void GetStringRegion(JNIEnv *env, jstring str, jsize start, jsize length, jchar *buf); | |
| // Copies len number of Unicode characters beginning at offset start to the given buffer buf | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment