diff options
author | Sven Gothel <[email protected]> | 2022-08-05 12:39:19 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-08-05 12:39:19 +0200 |
commit | f8bd6cbacb30c0c10dba47fa896e0f37e3d83272 (patch) | |
tree | cd971034c41de915f1286122add5cb7239cb98f1 /java_jni/jni/jau/ByteInStream_URL.cxx | |
parent | c82d4c266a80a8b41a184cdadd8ecae37bd635fd (diff) |
Java: Adopt to ByteInStream changes of commit c82d4c266a80a8b41a184cdadd8ecae37bd635fd
Diffstat (limited to 'java_jni/jni/jau/ByteInStream_URL.cxx')
-rw-r--r-- | java_jni/jni/jau/ByteInStream_URL.cxx | 98 |
1 files changed, 73 insertions, 25 deletions
diff --git a/java_jni/jni/jau/ByteInStream_URL.cxx b/java_jni/jni/jau/ByteInStream_URL.cxx index b85c114..17892d5 100644 --- a/java_jni/jni/jau/ByteInStream_URL.cxx +++ b/java_jni/jni/jau/ByteInStream_URL.cxx @@ -66,10 +66,78 @@ void Java_org_jau_io_ByteInStream_1URL_dtorImpl(JNIEnv *env, jclass clazz, jlong } } -jboolean Java_org_jau_io_ByteInStream_1URL_check_1available(JNIEnv *env, jobject obj, jlong n) { +void Java_org_jau_io_ByteInStream_1URL_clearImpl(JNIEnv *env, jobject obj, jint mask) { try { jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done - return ref->check_available((size_t)n) ? JNI_TRUE : JNI_FALSE; + ref->clear( static_cast<jau::io::iostate>(mask) ); + } catch(...) { + rethrow_and_raise_java_exception_jau(env); + } +} + +jint Java_org_jau_io_ByteInStream_1URL_rdStateImpl(JNIEnv *env, jobject obj) { + try { + jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done + return static_cast<jint>( ref->rdstate() ); + } catch(...) { + rethrow_and_raise_java_exception_jau(env); + } + return static_cast<jint>(jau::io::iostate::failbit); +} + +void Java_org_jau_io_ByteInStream_1URL_setStateImpl(JNIEnv *env, jobject obj, jint mask) { + try { + jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done + ref->setstate( static_cast<jau::io::iostate>(mask) ); + } catch(...) { + rethrow_and_raise_java_exception_jau(env); + } +} + +jboolean Java_org_jau_io_ByteInStream_1URL_good(JNIEnv *env, jobject obj) { + try { + jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done + return ref->good() ? JNI_TRUE : JNI_FALSE; + } catch(...) { + rethrow_and_raise_java_exception_jau(env); + } + return JNI_FALSE; +} + +jboolean Java_org_jau_io_ByteInStream_1URL_eof(JNIEnv *env, jobject obj) { + try { + jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done + return ref->eof() ? JNI_TRUE : JNI_FALSE; + } catch(...) { + rethrow_and_raise_java_exception_jau(env); + } + return JNI_TRUE; +} + +jboolean Java_org_jau_io_ByteInStream_1URL_fail(JNIEnv *env, jobject obj) { + try { + jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done + return ref->fail() ? JNI_TRUE : JNI_FALSE; + } catch(...) { + rethrow_and_raise_java_exception_jau(env); + } + return JNI_TRUE; +} + +jboolean Java_org_jau_io_ByteInStream_1URL_bad(JNIEnv *env, jobject obj) { + try { + jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done + return ref->bad() ? JNI_TRUE : JNI_FALSE; + } catch(...) { + rethrow_and_raise_java_exception_jau(env); + } + return JNI_FALSE; +} + +jboolean Java_org_jau_io_ByteInStream_1URL_available(JNIEnv *env, jobject obj, jlong n) { + try { + jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done + return ref->available((size_t)n) ? JNI_TRUE : JNI_FALSE; } catch(...) { rethrow_and_raise_java_exception_jau(env); } @@ -142,26 +210,6 @@ jint Java_org_jau_io_ByteInStream_1URL_peek(JNIEnv *env, jobject obj, jbyteArray return 0; } -jboolean Java_org_jau_io_ByteInStream_1URL_end_1of_1data(JNIEnv *env, jobject obj) { - try { - jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done - return ref->end_of_data() ? JNI_TRUE : JNI_FALSE; - } catch(...) { - rethrow_and_raise_java_exception_jau(env); - } - return JNI_TRUE; -} - -jboolean Java_org_jau_io_ByteInStream_1URL_error(JNIEnv *env, jobject obj) { - try { - jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done - return ref->error() ? JNI_TRUE : JNI_FALSE; - } catch(...) { - rethrow_and_raise_java_exception_jau(env); - } - return JNI_TRUE; -} - jstring Java_org_jau_io_ByteInStream_1URL_id(JNIEnv *env, jobject obj) { try { jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done @@ -176,7 +224,7 @@ jlong Java_org_jau_io_ByteInStream_1URL_discard_1next(JNIEnv *env, jobject obj, try { jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done - const size_t res = ref->discard_next(n); + const size_t res = ref->discard(n); return (jlong)res; } catch(...) { rethrow_and_raise_java_exception_jau(env); @@ -184,10 +232,10 @@ jlong Java_org_jau_io_ByteInStream_1URL_discard_1next(JNIEnv *env, jobject obj, return 0; } -jlong Java_org_jau_io_ByteInStream_1URL_get_1bytes_1read(JNIEnv *env, jobject obj) { +jlong Java_org_jau_io_ByteInStream_1URL_tellg(JNIEnv *env, jobject obj) { try { jau::jni::shared_ptr_ref<jau::io::ByteInStream_URL> ref(env, obj); // hold until done - return static_cast<jlong>( ref->get_bytes_read() ); + return static_cast<jlong>( ref->tellg() ); } catch(...) { rethrow_and_raise_java_exception_jau(env); } |