ByteBuffer.c 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * Copyright (C) 2015 Zhang Rui <bbcallen@gmail.com>
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /*
  17. * https://github.com/Bilibili/jni4android
  18. * This file is automatically generated by jni4android, do not modify.
  19. */
  20. #include "ByteBuffer.h"
  21. typedef struct J4AC_java_nio_ByteBuffer {
  22. jclass id;
  23. jmethodID method_allocate;
  24. jmethodID method_allocateDirect;
  25. jmethodID method_limit;
  26. } J4AC_java_nio_ByteBuffer;
  27. static J4AC_java_nio_ByteBuffer class_J4AC_java_nio_ByteBuffer;
  28. jobject J4AC_java_nio_ByteBuffer__allocate(JNIEnv *env, jint capacity)
  29. {
  30. return (*env)->CallStaticObjectMethod(env, class_J4AC_java_nio_ByteBuffer.id, class_J4AC_java_nio_ByteBuffer.method_allocate, capacity);
  31. }
  32. jobject J4AC_java_nio_ByteBuffer__allocate__catchAll(JNIEnv *env, jint capacity)
  33. {
  34. jobject ret_object = J4AC_java_nio_ByteBuffer__allocate(env, capacity);
  35. if (J4A_ExceptionCheck__catchAll(env) || !ret_object) {
  36. return NULL;
  37. }
  38. return ret_object;
  39. }
  40. jobject J4AC_java_nio_ByteBuffer__allocate__asGlobalRef__catchAll(JNIEnv *env, jint capacity)
  41. {
  42. jobject ret_object = NULL;
  43. jobject local_object = J4AC_java_nio_ByteBuffer__allocate__catchAll(env, capacity);
  44. if (J4A_ExceptionCheck__catchAll(env) || !local_object) {
  45. ret_object = NULL;
  46. goto fail;
  47. }
  48. ret_object = J4A_NewGlobalRef__catchAll(env, local_object);
  49. if (!ret_object) {
  50. ret_object = NULL;
  51. goto fail;
  52. }
  53. fail:
  54. J4A_DeleteLocalRef__p(env, &local_object);
  55. return ret_object;
  56. }
  57. jobject J4AC_java_nio_ByteBuffer__allocateDirect(JNIEnv *env, jint capacity)
  58. {
  59. return (*env)->CallStaticObjectMethod(env, class_J4AC_java_nio_ByteBuffer.id, class_J4AC_java_nio_ByteBuffer.method_allocateDirect, capacity);
  60. }
  61. jobject J4AC_java_nio_ByteBuffer__allocateDirect__catchAll(JNIEnv *env, jint capacity)
  62. {
  63. jobject ret_object = J4AC_java_nio_ByteBuffer__allocateDirect(env, capacity);
  64. if (J4A_ExceptionCheck__catchAll(env) || !ret_object) {
  65. return NULL;
  66. }
  67. return ret_object;
  68. }
  69. jobject J4AC_java_nio_ByteBuffer__allocateDirect__asGlobalRef__catchAll(JNIEnv *env, jint capacity)
  70. {
  71. jobject ret_object = NULL;
  72. jobject local_object = J4AC_java_nio_ByteBuffer__allocateDirect__catchAll(env, capacity);
  73. if (J4A_ExceptionCheck__catchAll(env) || !local_object) {
  74. ret_object = NULL;
  75. goto fail;
  76. }
  77. ret_object = J4A_NewGlobalRef__catchAll(env, local_object);
  78. if (!ret_object) {
  79. ret_object = NULL;
  80. goto fail;
  81. }
  82. fail:
  83. J4A_DeleteLocalRef__p(env, &local_object);
  84. return ret_object;
  85. }
  86. jobject J4AC_java_nio_ByteBuffer__limit(JNIEnv *env, jobject thiz, jint newLimit)
  87. {
  88. return (*env)->CallObjectMethod(env, thiz, class_J4AC_java_nio_ByteBuffer.method_limit, newLimit);
  89. }
  90. jobject J4AC_java_nio_ByteBuffer__limit__catchAll(JNIEnv *env, jobject thiz, jint newLimit)
  91. {
  92. jobject ret_object = J4AC_java_nio_ByteBuffer__limit(env, thiz, newLimit);
  93. if (J4A_ExceptionCheck__catchAll(env) || !ret_object) {
  94. return NULL;
  95. }
  96. return ret_object;
  97. }
  98. jobject J4AC_java_nio_ByteBuffer__limit__asGlobalRef__catchAll(JNIEnv *env, jobject thiz, jint newLimit)
  99. {
  100. jobject ret_object = NULL;
  101. jobject local_object = J4AC_java_nio_ByteBuffer__limit__catchAll(env, thiz, newLimit);
  102. if (J4A_ExceptionCheck__catchAll(env) || !local_object) {
  103. ret_object = NULL;
  104. goto fail;
  105. }
  106. ret_object = J4A_NewGlobalRef__catchAll(env, local_object);
  107. if (!ret_object) {
  108. ret_object = NULL;
  109. goto fail;
  110. }
  111. fail:
  112. J4A_DeleteLocalRef__p(env, &local_object);
  113. return ret_object;
  114. }
  115. int J4A_loadClass__J4AC_java_nio_ByteBuffer(JNIEnv *env)
  116. {
  117. int ret = -1;
  118. const char *J4A_UNUSED(name) = NULL;
  119. const char *J4A_UNUSED(sign) = NULL;
  120. jclass J4A_UNUSED(class_id) = NULL;
  121. int J4A_UNUSED(api_level) = 0;
  122. if (class_J4AC_java_nio_ByteBuffer.id != NULL)
  123. return 0;
  124. sign = "java/nio/ByteBuffer";
  125. class_J4AC_java_nio_ByteBuffer.id = J4A_FindClass__asGlobalRef__catchAll(env, sign);
  126. if (class_J4AC_java_nio_ByteBuffer.id == NULL)
  127. goto fail;
  128. class_id = class_J4AC_java_nio_ByteBuffer.id;
  129. name = "allocate";
  130. sign = "(I)Ljava/nio/ByteBuffer;";
  131. class_J4AC_java_nio_ByteBuffer.method_allocate = J4A_GetStaticMethodID__catchAll(env, class_id, name, sign);
  132. if (class_J4AC_java_nio_ByteBuffer.method_allocate == NULL)
  133. goto fail;
  134. class_id = class_J4AC_java_nio_ByteBuffer.id;
  135. name = "allocateDirect";
  136. sign = "(I)Ljava/nio/ByteBuffer;";
  137. class_J4AC_java_nio_ByteBuffer.method_allocateDirect = J4A_GetStaticMethodID__catchAll(env, class_id, name, sign);
  138. if (class_J4AC_java_nio_ByteBuffer.method_allocateDirect == NULL)
  139. goto fail;
  140. class_id = class_J4AC_java_nio_ByteBuffer.id;
  141. name = "limit";
  142. sign = "(I)Ljava/nio/Buffer;";
  143. class_J4AC_java_nio_ByteBuffer.method_limit = J4A_GetMethodID__catchAll(env, class_id, name, sign);
  144. if (class_J4AC_java_nio_ByteBuffer.method_limit == NULL)
  145. goto fail;
  146. J4A_ALOGD("J4ALoader: OK: '%s' loaded\n", "java.nio.ByteBuffer");
  147. ret = 0;
  148. fail:
  149. return ret;
  150. }