1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // This file is autogenerated by 6 // base/android/jni_generator/jni_generator.py 7 // For 8 // java/io/InputStream 9 10 #ifndef java_io_InputStream_JNI 11 #define java_io_InputStream_JNI 12 13 #include <jni.h> 14 15 #include "base/android/jni_generator/jni_generator_helper.h" 16 17 #include "base/android/jni_int_wrapper.h" 18 19 // Step 1: forward declarations. 20 namespace { 21 const char kInputStreamClassPath[] = "java/io/InputStream"; 22 // Leaking this jclass as we cannot use LazyInstance from some threads. 23 jclass g_InputStream_clazz = NULL; 24 #define InputStream_clazz(env) g_InputStream_clazz 25 26 } // namespace 27 28 namespace JNI_InputStream { 29 30 // Step 2: method stubs. 31 32 static base::subtle::AtomicWord g_InputStream_available = 0; 33 static jint Java_InputStream_available(JNIEnv* env, jobject obj) __attribute__ 34 ((unused)); 35 static jint Java_InputStream_available(JNIEnv* env, jobject obj) { 36 /* Must call RegisterNativesImpl() */ 37 CHECK_CLAZZ(env, obj, 38 InputStream_clazz(env), 0); 39 jmethodID method_id = 40 base::android::MethodID::LazyGet< 41 base::android::MethodID::TYPE_INSTANCE>( 42 env, InputStream_clazz(env), 43 "available", 44 "()I", 45 &g_InputStream_available); 46 47 jint ret = 48 env->CallIntMethod(obj, 49 method_id); 50 jni_generator::CheckException(env); 51 return ret; 52 } 53 54 static base::subtle::AtomicWord g_InputStream_close = 0; 55 static void Java_InputStream_close(JNIEnv* env, jobject obj) __attribute__ 56 ((unused)); 57 static void Java_InputStream_close(JNIEnv* env, jobject obj) { 58 /* Must call RegisterNativesImpl() */ 59 CHECK_CLAZZ(env, obj, 60 InputStream_clazz(env)); 61 jmethodID method_id = 62 base::android::MethodID::LazyGet< 63 base::android::MethodID::TYPE_INSTANCE>( 64 env, InputStream_clazz(env), 65 "close", 66 "()V", 67 &g_InputStream_close); 68 69 env->CallVoidMethod(obj, 70 method_id); 71 jni_generator::CheckException(env); 72 73 } 74 75 static base::subtle::AtomicWord g_InputStream_mark = 0; 76 static void Java_InputStream_mark(JNIEnv* env, jobject obj, JniIntWrapper p0) 77 __attribute__ ((unused)); 78 static void Java_InputStream_mark(JNIEnv* env, jobject obj, JniIntWrapper p0) { 79 /* Must call RegisterNativesImpl() */ 80 CHECK_CLAZZ(env, obj, 81 InputStream_clazz(env)); 82 jmethodID method_id = 83 base::android::MethodID::LazyGet< 84 base::android::MethodID::TYPE_INSTANCE>( 85 env, InputStream_clazz(env), 86 "mark", 87 "(I)V", 88 &g_InputStream_mark); 89 90 env->CallVoidMethod(obj, 91 method_id, as_jint(p0)); 92 jni_generator::CheckException(env); 93 94 } 95 96 static base::subtle::AtomicWord g_InputStream_markSupported = 0; 97 static jboolean Java_InputStream_markSupported(JNIEnv* env, jobject obj) 98 __attribute__ ((unused)); 99 static jboolean Java_InputStream_markSupported(JNIEnv* env, jobject obj) { 100 /* Must call RegisterNativesImpl() */ 101 CHECK_CLAZZ(env, obj, 102 InputStream_clazz(env), false); 103 jmethodID method_id = 104 base::android::MethodID::LazyGet< 105 base::android::MethodID::TYPE_INSTANCE>( 106 env, InputStream_clazz(env), 107 "markSupported", 108 "()Z", 109 &g_InputStream_markSupported); 110 111 jboolean ret = 112 env->CallBooleanMethod(obj, 113 method_id); 114 jni_generator::CheckException(env); 115 return ret; 116 } 117 118 static base::subtle::AtomicWord g_InputStream_readI = 0; 119 static jint Java_InputStream_readI(JNIEnv* env, jobject obj) __attribute__ 120 ((unused)); 121 static jint Java_InputStream_readI(JNIEnv* env, jobject obj) { 122 /* Must call RegisterNativesImpl() */ 123 CHECK_CLAZZ(env, obj, 124 InputStream_clazz(env), 0); 125 jmethodID method_id = 126 base::android::MethodID::LazyGet< 127 base::android::MethodID::TYPE_INSTANCE>( 128 env, InputStream_clazz(env), 129 "read", 130 "()I", 131 &g_InputStream_readI); 132 133 jint ret = 134 env->CallIntMethod(obj, 135 method_id); 136 jni_generator::CheckException(env); 137 return ret; 138 } 139 140 static base::subtle::AtomicWord g_InputStream_readI_AB = 0; 141 static jint Java_InputStream_readI_AB(JNIEnv* env, jobject obj, jbyteArray p0) 142 __attribute__ ((unused)); 143 static jint Java_InputStream_readI_AB(JNIEnv* env, jobject obj, jbyteArray p0) { 144 /* Must call RegisterNativesImpl() */ 145 CHECK_CLAZZ(env, obj, 146 InputStream_clazz(env), 0); 147 jmethodID method_id = 148 base::android::MethodID::LazyGet< 149 base::android::MethodID::TYPE_INSTANCE>( 150 env, InputStream_clazz(env), 151 "read", 152 "([B)I", 153 &g_InputStream_readI_AB); 154 155 jint ret = 156 env->CallIntMethod(obj, 157 method_id, p0); 158 jni_generator::CheckException(env); 159 return ret; 160 } 161 162 static base::subtle::AtomicWord g_InputStream_readI_AB_I_I = 0; 163 static jint Java_InputStream_readI_AB_I_I(JNIEnv* env, jobject obj, jbyteArray 164 p0, 165 JniIntWrapper p1, 166 JniIntWrapper p2) __attribute__ ((unused)); 167 static jint Java_InputStream_readI_AB_I_I(JNIEnv* env, jobject obj, jbyteArray 168 p0, 169 JniIntWrapper p1, 170 JniIntWrapper p2) { 171 /* Must call RegisterNativesImpl() */ 172 CHECK_CLAZZ(env, obj, 173 InputStream_clazz(env), 0); 174 jmethodID method_id = 175 base::android::MethodID::LazyGet< 176 base::android::MethodID::TYPE_INSTANCE>( 177 env, InputStream_clazz(env), 178 "read", 179 "([BII)I", 180 &g_InputStream_readI_AB_I_I); 181 182 jint ret = 183 env->CallIntMethod(obj, 184 method_id, p0, as_jint(p1), as_jint(p2)); 185 jni_generator::CheckException(env); 186 return ret; 187 } 188 189 static base::subtle::AtomicWord g_InputStream_reset = 0; 190 static void Java_InputStream_reset(JNIEnv* env, jobject obj) __attribute__ 191 ((unused)); 192 static void Java_InputStream_reset(JNIEnv* env, jobject obj) { 193 /* Must call RegisterNativesImpl() */ 194 CHECK_CLAZZ(env, obj, 195 InputStream_clazz(env)); 196 jmethodID method_id = 197 base::android::MethodID::LazyGet< 198 base::android::MethodID::TYPE_INSTANCE>( 199 env, InputStream_clazz(env), 200 "reset", 201 "()V", 202 &g_InputStream_reset); 203 204 env->CallVoidMethod(obj, 205 method_id); 206 jni_generator::CheckException(env); 207 208 } 209 210 static base::subtle::AtomicWord g_InputStream_skip = 0; 211 static jlong Java_InputStream_skip(JNIEnv* env, jobject obj, jlong p0) 212 __attribute__ ((unused)); 213 static jlong Java_InputStream_skip(JNIEnv* env, jobject obj, jlong p0) { 214 /* Must call RegisterNativesImpl() */ 215 CHECK_CLAZZ(env, obj, 216 InputStream_clazz(env), 0); 217 jmethodID method_id = 218 base::android::MethodID::LazyGet< 219 base::android::MethodID::TYPE_INSTANCE>( 220 env, InputStream_clazz(env), 221 "skip", 222 "(J)J", 223 &g_InputStream_skip); 224 225 jlong ret = 226 env->CallLongMethod(obj, 227 method_id, p0); 228 jni_generator::CheckException(env); 229 return ret; 230 } 231 232 static base::subtle::AtomicWord g_InputStream_Constructor = 0; 233 static base::android::ScopedJavaLocalRef<jobject> 234 Java_InputStream_Constructor(JNIEnv* env) __attribute__ ((unused)); 235 static base::android::ScopedJavaLocalRef<jobject> 236 Java_InputStream_Constructor(JNIEnv* env) { 237 /* Must call RegisterNativesImpl() */ 238 CHECK_CLAZZ(env, InputStream_clazz(env), 239 InputStream_clazz(env), NULL); 240 jmethodID method_id = 241 base::android::MethodID::LazyGet< 242 base::android::MethodID::TYPE_INSTANCE>( 243 env, InputStream_clazz(env), 244 "<init>", 245 "()V", 246 &g_InputStream_Constructor); 247 248 jobject ret = 249 env->NewObject(InputStream_clazz(env), 250 method_id); 251 jni_generator::CheckException(env); 252 return base::android::ScopedJavaLocalRef<jobject>(env, ret); 253 } 254 255 // Step 3: RegisterNatives. 256 257 static bool RegisterNativesImpl(JNIEnv* env) { 258 g_InputStream_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( 259 base::android::GetClass(env, kInputStreamClassPath).obj())); 260 261 return true; 262 } 263 264 } // namespace JNI_InputStream 265 266 #endif // java_io_InputStream_JNI 267