src/java.base/share/native/libjava/jni_util.h
changeset 58493 55a8d95c7787
parent 57868 7ae075afc72f
child 58679 9c3209ff7550
child 58728 6d5c7f91e0b5
equal deleted inserted replaced
58492:227ddf1ff93d 58493:55a8d95c7787
    60 
    60 
    61 JNIEXPORT void JNICALL
    61 JNIEXPORT void JNICALL
    62 JNU_ThrowIllegalArgumentException(JNIEnv *env, const char *msg);
    62 JNU_ThrowIllegalArgumentException(JNIEnv *env, const char *msg);
    63 
    63 
    64 JNIEXPORT void JNICALL
    64 JNIEXPORT void JNICALL
    65 JNU_ThrowIllegalAccessError(JNIEnv *env, const char *msg);
       
    66 
       
    67 JNIEXPORT void JNICALL
       
    68 JNU_ThrowIllegalAccessException(JNIEnv *env, const char *msg);
       
    69 
       
    70 JNIEXPORT void JNICALL
       
    71 JNU_ThrowInternalError(JNIEnv *env, const char *msg);
    65 JNU_ThrowInternalError(JNIEnv *env, const char *msg);
    72 
    66 
    73 JNIEXPORT void JNICALL
    67 JNIEXPORT void JNICALL
    74 JNU_ThrowIOException(JNIEnv *env, const char *msg);
    68 JNU_ThrowIOException(JNIEnv *env, const char *msg);
    75 
    69 
    76 JNIEXPORT void JNICALL
    70 JNIEXPORT void JNICALL
    77 JNU_ThrowNoSuchFieldException(JNIEnv *env, const char *msg);
       
    78 
       
    79 JNIEXPORT void JNICALL
       
    80 JNU_ThrowNoSuchMethodException(JNIEnv *env, const char *msg);
       
    81 
       
    82 JNIEXPORT void JNICALL
       
    83 JNU_ThrowClassNotFoundException(JNIEnv *env, const char *msg);
    71 JNU_ThrowClassNotFoundException(JNIEnv *env, const char *msg);
    84 
       
    85 JNIEXPORT void JNICALL
       
    86 JNU_ThrowNumberFormatException(JNIEnv *env, const char *msg);
       
    87 
       
    88 JNIEXPORT void JNICALL
       
    89 JNU_ThrowNoSuchFieldError(JNIEnv *env, const char *msg);
       
    90 
       
    91 JNIEXPORT void JNICALL
       
    92 JNU_ThrowNoSuchMethodError(JNIEnv *env, const char *msg);
       
    93 
       
    94 JNIEXPORT void JNICALL
       
    95 JNU_ThrowStringIndexOutOfBoundsException(JNIEnv *env, const char *msg);
       
    96 
       
    97 JNIEXPORT void JNICALL
       
    98 JNU_ThrowInstantiationException(JNIEnv *env, const char *msg);
       
    99 
    72 
   100 /* Throw an exception by name, using the string returned by
    73 /* Throw an exception by name, using the string returned by
   101  * getLastErrorString for the detail string. If the last-error
    74  * getLastErrorString for the detail string. If the last-error
   102  * string is NULL, use the given default detail string.
    75  * string is NULL, use the given default detail string.
   103  */
    76  */
   118  */
    91  */
   119 JNIEXPORT void JNICALL
    92 JNIEXPORT void JNICALL
   120 JNU_ThrowIOExceptionWithLastError(JNIEnv *env, const char *defaultDetail);
    93 JNU_ThrowIOExceptionWithLastError(JNIEnv *env, const char *defaultDetail);
   121 
    94 
   122 /* Convert between Java strings and i18n C strings */
    95 /* Convert between Java strings and i18n C strings */
   123 JNIEXPORT jstring
       
   124 NewStringPlatform(JNIEnv *env, const char *str);
       
   125 
       
   126 JNIEXPORT const char *
    96 JNIEXPORT const char *
   127 GetStringPlatformChars(JNIEnv *env, jstring jstr, jboolean *isCopy);
    97 GetStringPlatformChars(JNIEnv *env, jstring jstr, jboolean *isCopy);
   128 
    98 
   129 JNIEXPORT jstring JNICALL
    99 JNIEXPORT jstring JNICALL
   130 JNU_NewStringPlatform(JNIEnv *env, const char *str);
   100 JNU_NewStringPlatform(JNIEnv *env, const char *str);
   136 JNU_ReleaseStringPlatformChars(JNIEnv *env, jstring jstr, const char *str);
   106 JNU_ReleaseStringPlatformChars(JNIEnv *env, jstring jstr, const char *str);
   137 
   107 
   138 /* Class constants */
   108 /* Class constants */
   139 JNIEXPORT jclass JNICALL
   109 JNIEXPORT jclass JNICALL
   140 JNU_ClassString(JNIEnv *env);
   110 JNU_ClassString(JNIEnv *env);
   141 
       
   142 JNIEXPORT jclass JNICALL
       
   143 JNU_ClassClass(JNIEnv *env);
       
   144 
       
   145 JNIEXPORT jclass JNICALL
       
   146 JNU_ClassObject(JNIEnv *env);
       
   147 
       
   148 JNIEXPORT jclass JNICALL
       
   149 JNU_ClassThrowable(JNIEnv *env);
       
   150 
   111 
   151 /* Copy count number of arguments from src to dst. Array bounds
   112 /* Copy count number of arguments from src to dst. Array bounds
   152  * and ArrayStoreException are checked.
   113  * and ArrayStoreException are checked.
   153  */
   114  */
   154 JNIEXPORT jint JNICALL
   115 JNIEXPORT jint JNICALL
   244 JNU_GetStaticFieldByName(JNIEnv *env,
   205 JNU_GetStaticFieldByName(JNIEnv *env,
   245                          jboolean *hasException,
   206                          jboolean *hasException,
   246                          const char *classname,
   207                          const char *classname,
   247                          const char *name,
   208                          const char *name,
   248                          const char *sig);
   209                          const char *sig);
   249 JNIEXPORT void JNICALL
       
   250 JNU_SetStaticFieldByName(JNIEnv *env,
       
   251                          jboolean *hasException,
       
   252                          const char *classname,
       
   253                          const char *name,
       
   254                          const char *sig,
       
   255                          ...);
       
   256 
       
   257 
       
   258 /*
       
   259  * Calls the .equals method.
       
   260  */
       
   261 JNIEXPORT jboolean JNICALL
       
   262 JNU_Equals(JNIEnv *env, jobject object1, jobject object2);
       
   263 
       
   264 
       
   265 /************************************************************************
       
   266  * Thread calls
       
   267  *
       
   268  * Convenience thread-related calls on the java.lang.Object class.
       
   269  */
       
   270 
       
   271 JNIEXPORT void JNICALL
       
   272 JNU_MonitorWait(JNIEnv *env, jobject object, jlong timeout);
       
   273 
       
   274 JNIEXPORT void JNICALL
       
   275 JNU_Notify(JNIEnv *env, jobject object);
       
   276 
       
   277 JNIEXPORT void JNICALL
       
   278 JNU_NotifyAll(JNIEnv *env, jobject object);
       
   279 
   210 
   280 
   211 
   281 /************************************************************************
   212 /************************************************************************
   282  * Miscellaneous utilities used by the class libraries
   213  * Miscellaneous utilities used by the class libraries
   283  */
   214  */
   347         if ((*env)->ExceptionCheck(env)) {      \
   278         if ((*env)->ExceptionCheck(env)) {      \
   348             return (y);                         \
   279             return (y);                         \
   349         }                                       \
   280         }                                       \
   350     } while (0)
   281     } while (0)
   351 #endif /* __cplusplus */
   282 #endif /* __cplusplus */
       
   283 
   352 /************************************************************************
   284 /************************************************************************
   353  * Debugging utilities
   285  * Debugging utilities
   354  */
   286  */
   355 
   287 
   356 JNIEXPORT void JNICALL
       
   357 JNU_PrintString(JNIEnv *env, char *hdr, jstring string);
       
   358 
       
   359 JNIEXPORT void JNICALL
       
   360 JNU_PrintClass(JNIEnv *env, char *hdr, jobject object);
       
   361 
       
   362 JNIEXPORT jstring JNICALL
   288 JNIEXPORT jstring JNICALL
   363 JNU_ToString(JNIEnv *env, jobject object);
   289 JNU_ToString(JNIEnv *env, jobject object);
       
   290 
   364 
   291 
   365 /*
   292 /*
   366  * Package shorthand for use by native libraries
   293  * Package shorthand for use by native libraries
   367  */
   294  */
   368 #define JNU_JAVAPKG         "java/lang/"
   295 #define JNU_JAVAPKG         "java/lang/"
   400     FAST_CP1252,                /* MS-DOS Cp1252 */
   327     FAST_CP1252,                /* MS-DOS Cp1252 */
   401     FAST_646_US,                /* US-ASCII : ISO646-US */
   328     FAST_646_US,                /* US-ASCII : ISO646-US */
   402     FAST_UTF_8
   329     FAST_UTF_8
   403 };
   330 };
   404 
   331 
   405 int getFastEncoding();
       
   406 
       
   407 JNIEXPORT void InitializeEncoding(JNIEnv *env, const char *name);
   332 JNIEXPORT void InitializeEncoding(JNIEnv *env, const char *name);
   408 
   333 
   409 void* getProcessHandle();
   334 void* getProcessHandle();
   410 
   335 
   411 void buildJniFunctionName(const char *sym, const char *cname,
   336 void buildJniFunctionName(const char *sym, const char *cname,