From e19094aba55a0f245dfea3354289572c71e4e81d Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Thu, 14 Sep 2023 09:07:20 -0700 Subject: [PATCH] Use efficient operations when copying bytes between Dart and Java (#1019) --- pkgs/cronet_http/CHANGELOG.md | 4 + pkgs/cronet_http/android/build.gradle | 10 + pkgs/cronet_http/android/consumer-rules.pro | 1 + .../example/android/app/build.gradle | 3 + pkgs/cronet_http/jnigen.yaml | 4 - pkgs/cronet_http/lib/src/cronet_client.dart | 28 +- .../cronet_http/lib/src/jni/jni_bindings.dart | 1507 +---------------- pkgs/cronet_http/pubspec.yaml | 6 +- 8 files changed, 124 insertions(+), 1439 deletions(-) create mode 100644 pkgs/cronet_http/android/consumer-rules.pro diff --git a/pkgs/cronet_http/CHANGELOG.md b/pkgs/cronet_http/CHANGELOG.md index 416553137a..28116260c7 100644 --- a/pkgs/cronet_http/CHANGELOG.md +++ b/pkgs/cronet_http/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.0-jni + +* Use more efficient operations when copying bytes between Java and Dart. + ## 0.3.0-jni * Switch to using `package:jnigen` for bindings to Cronet diff --git a/pkgs/cronet_http/android/build.gradle b/pkgs/cronet_http/android/build.gradle index bf79214106..3a91d8a295 100644 --- a/pkgs/cronet_http/android/build.gradle +++ b/pkgs/cronet_http/android/build.gradle @@ -43,6 +43,16 @@ android { defaultConfig { minSdkVersion 16 } + + defaultConfig { + consumerProguardFiles 'consumer-rules.pro' + } + + buildTypes { + release { + minifyEnabled false + } + } } dependencies { diff --git a/pkgs/cronet_http/android/consumer-rules.pro b/pkgs/cronet_http/android/consumer-rules.pro new file mode 100644 index 0000000000..00f4f3efe1 --- /dev/null +++ b/pkgs/cronet_http/android/consumer-rules.pro @@ -0,0 +1 @@ +-keep class io.flutter.plugins.cronet_http.** { *; } diff --git a/pkgs/cronet_http/example/android/app/build.gradle b/pkgs/cronet_http/example/android/app/build.gradle index d42d02a0da..88b33564c3 100644 --- a/pkgs/cronet_http/example/android/app/build.gradle +++ b/pkgs/cronet_http/example/android/app/build.gradle @@ -67,4 +67,7 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + // ""com.google.android.gms:play-services-cronet" is only present so that + // `jnigen` will work. Applications should not include this line. + implementation "com.google.android.gms:play-services-cronet:18.0.1" } diff --git a/pkgs/cronet_http/jnigen.yaml b/pkgs/cronet_http/jnigen.yaml index 1b2f2a7490..a16d38f48d 100644 --- a/pkgs/cronet_http/jnigen.yaml +++ b/pkgs/cronet_http/jnigen.yaml @@ -7,8 +7,6 @@ android_sdk_config: add_gradle_deps: true android_example: 'example/' -suspend_fun_to_async: true - output: bindings_type: dart_only dart: @@ -18,8 +16,6 @@ output: classes: - 'io.flutter.plugins.cronet_http.UrlRequestCallbackProxy' - 'java.net.URL' - - 'java.nio.Buffer' - - 'java.nio.ByteBuffer' - 'java.util.concurrent.Executors' - 'org.chromium.net.CronetEngine' - 'org.chromium.net.CronetException' diff --git a/pkgs/cronet_http/lib/src/cronet_client.dart b/pkgs/cronet_http/lib/src/cronet_client.dart index ec6258affd..69143208fc 100644 --- a/pkgs/cronet_http/lib/src/cronet_client.dart +++ b/pkgs/cronet_http/lib/src/cronet_client.dart @@ -14,7 +14,6 @@ library; import 'dart:async'; -import 'dart:typed_data'; import 'package:http/http.dart'; import 'package:jni/jni.dart'; @@ -22,6 +21,7 @@ import 'package:jni/jni.dart'; import 'jni/jni_bindings.dart' as jb; final _digitRegex = RegExp(r'^\d+$'); +const _bufferSize = 10 * 1024; // The size of the Cronet read buffer. /// The type of caching to use when making HTTP requests. enum CacheMode { @@ -138,7 +138,7 @@ Map _cronetToClientHeaders( jb.UrlRequestCallbackProxy_UrlRequestCallbackInterface _urlRequestCallbacks( BaseRequest request, Completer responseCompleter) { StreamController>? responseStream; - jb.ByteBuffer? byteBuffer; + JByteBuffer? jByteBuffer; var numRedirects = 0; // The order of callbacks generated by Cronet is documented here: @@ -175,8 +175,8 @@ jb.UrlRequestCallbackProxy_UrlRequestCallbackInterface _urlRequestCallbacks( headers: responseHeaders, )); - byteBuffer = jb.ByteBuffer.allocateDirect(1024 * 1024); - urlRequest.read(byteBuffer!); + jByteBuffer = JByteBuffer.allocateDirect(_bufferSize); + urlRequest.read(jByteBuffer!); }, onRedirectReceived: (urlRequest, responseInfo, newLocationUrl) { if (!request.followRedirects) { @@ -204,20 +204,15 @@ jb.UrlRequestCallbackProxy_UrlRequestCallbackInterface _urlRequestCallbacks( }, onReadCompleted: (urlRequest, responseInfo, byteBuffer) { byteBuffer.flip(); + responseStream! + .add(jByteBuffer!.asUint8List().sublist(0, byteBuffer.remaining)); - final remaining = byteBuffer.remaining(); - final data = Uint8List(remaining); - // TODO: Use a more efficient approach when - // https://github.com/dart-lang/jnigen/issues/387 is fixed. - for (var i = 0; i < remaining; ++i) { - data[i] = byteBuffer.get1(i); - } - responseStream!.add(data); byteBuffer.clear(); urlRequest.read(byteBuffer); }, onSucceeded: (urlRequest, responseInfo) { responseStream!.sink.close(); + jByteBuffer?.release(); }, onFailed: (urlRequest, responseInfo, cronetException) { final error = ClientException( @@ -228,6 +223,7 @@ jb.UrlRequestCallbackProxy_UrlRequestCallbackInterface _urlRequestCallbacks( responseStream!.addError(error); responseStream!.close(); } + jByteBuffer?.release(); }, )); } @@ -333,14 +329,8 @@ class CronetClient extends BaseClient { headers.forEach((k, v) => builder.addHeader(k.toJString(), v.toJString())); if (body.isNotEmpty) { - // TODO: Use a more efficient approach when - // https://github.com/dart-lang/jnigen/issues/387 is fixed. - final bodyBytes = JArray(jbyte.type, body.length); - for (var i = 0; i < body.length; ++i) { - bodyBytes[i] = body[i]; - } builder.setUploadDataProvider( - jb.UploadDataProviders.create4(bodyBytes), _executor); + jb.UploadDataProviders.create2(body.toJByteBuffer()), _executor); } builder.build().start(); return responseCompleter.future; diff --git a/pkgs/cronet_http/lib/src/jni/jni_bindings.dart b/pkgs/cronet_http/lib/src/jni/jni_bindings.dart index 2479675771..c8df6936f2 100644 --- a/pkgs/cronet_http/lib/src/jni/jni_bindings.dart +++ b/pkgs/cronet_http/lib/src/jni/jni_bindings.dart @@ -1,11 +1,11 @@ // Autogenerated by jnigen. DO NOT EDIT! -import 'dart:ffi' as ffi; // ignore_for_file: annotate_overrides // ignore_for_file: camel_case_extensions // ignore_for_file: camel_case_types // ignore_for_file: constant_identifier_names // ignore_for_file: file_names +// ignore_for_file: lines_longer_than_80_chars // ignore_for_file: no_leading_underscores_for_local_identifiers // ignore_for_file: non_constant_identifier_names // ignore_for_file: overridden_fields @@ -15,10 +15,9 @@ import 'dart:ffi' as ffi; // ignore_for_file: unused_import // ignore_for_file: unused_local_variable // ignore_for_file: unused_shown_name -// ignore_for_file: lines_longer_than_80_chars +import 'dart:ffi' as ffi; import 'dart:isolate' show ReceivePort; - import 'package:jni/internal_helpers_for_jnigen.dart'; import 'package:jni/jni.dart' as jni; @@ -81,7 +80,7 @@ class UrlRequestCallbackProxy_UrlRequestCallbackInterface extends jni.JObject { void onReadCompleted( UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, - ByteBuffer byteBuffer, + jni.JByteBuffer byteBuffer, ) => jni.Jni.accessors.callMethodWithArgs( reference, _id_onReadCompleted, jni.JniCallType.voidType, [ @@ -178,7 +177,7 @@ class UrlRequestCallbackProxy_UrlRequestCallbackInterface extends jni.JObject { _$impls[$p]!.onReadCompleted( $a[0].castTo(const $UrlRequestType(), releaseOriginal: true), $a[1].castTo(const $UrlResponseInfoType(), releaseOriginal: true), - $a[2].castTo(const $ByteBufferType(), releaseOriginal: true), + $a[2].castTo(const jni.JByteBufferType(), releaseOriginal: true), ); return jni.nullptr; } @@ -241,7 +240,7 @@ abstract class $UrlRequestCallbackProxy_UrlRequestCallbackInterfaceImpl { UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) onResponseStarted, required void Function(UrlRequest urlRequest, - UrlResponseInfo urlResponseInfo, ByteBuffer byteBuffer) + UrlResponseInfo urlResponseInfo, jni.JByteBuffer byteBuffer) onReadCompleted, required void Function( UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) @@ -256,7 +255,7 @@ abstract class $UrlRequestCallbackProxy_UrlRequestCallbackInterfaceImpl { void onResponseStarted( UrlRequest urlRequest, UrlResponseInfo urlResponseInfo); void onReadCompleted(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, - ByteBuffer byteBuffer); + jni.JByteBuffer byteBuffer); void onSucceeded(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo); void onFailed(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, CronetException cronetException); @@ -272,7 +271,7 @@ class _$UrlRequestCallbackProxy_UrlRequestCallbackInterfaceImpl UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) onResponseStarted, required void Function(UrlRequest urlRequest, - UrlResponseInfo urlResponseInfo, ByteBuffer byteBuffer) + UrlResponseInfo urlResponseInfo, jni.JByteBuffer byteBuffer) onReadCompleted, required void Function( UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) @@ -291,7 +290,7 @@ class _$UrlRequestCallbackProxy_UrlRequestCallbackInterfaceImpl final void Function(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) _onResponseStarted; final void Function(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, - ByteBuffer byteBuffer) _onReadCompleted; + jni.JByteBuffer byteBuffer) _onReadCompleted; final void Function(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) _onSucceeded; final void Function(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, @@ -306,7 +305,7 @@ class _$UrlRequestCallbackProxy_UrlRequestCallbackInterfaceImpl _onResponseStarted(urlRequest, urlResponseInfo); void onReadCompleted(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, - ByteBuffer byteBuffer) => + jni.JByteBuffer byteBuffer) => _onReadCompleted(urlRequest, urlResponseInfo, byteBuffer); void onSucceeded(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo) => @@ -317,7 +316,7 @@ class _$UrlRequestCallbackProxy_UrlRequestCallbackInterfaceImpl _onFailed(urlRequest, urlResponseInfo, cronetException); } -class $UrlRequestCallbackProxy_UrlRequestCallbackInterfaceType +final class $UrlRequestCallbackProxy_UrlRequestCallbackInterfaceType extends jni.JObjType { const $UrlRequestCallbackProxy_UrlRequestCallbackInterfaceType(); @@ -432,7 +431,7 @@ class UrlRequestCallbackProxy extends UrlRequest_Callback { void onReadCompleted( UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, - ByteBuffer byteBuffer, + jni.JByteBuffer byteBuffer, ) => jni.Jni.accessors.callMethodWithArgs( reference, _id_onReadCompleted, jni.JniCallType.voidType, [ @@ -476,7 +475,7 @@ class UrlRequestCallbackProxy extends UrlRequest_Callback { ]).check(); } -class $UrlRequestCallbackProxyType +final class $UrlRequestCallbackProxyType extends jni.JObjType { const $UrlRequestCallbackProxyType(); @@ -743,1082 +742,117 @@ class URL extends jni.JObject { /// from: public java.lang.String toExternalForm() /// The returned object must be released after use, by calling the [release] method. jni.JString toExternalForm() => - const jni.JStringType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_toExternalForm, - jni.JniCallType.objectType, []).object); - - static final _id_toURI = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'toURI', r'()Ljava/net/URI;'); - - /// from: public java.net.URI toURI() - /// The returned object must be released after use, by calling the [release] method. - jni.JObject toURI() => - const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_toURI, jni.JniCallType.objectType, []).object); - - static final _id_openConnection = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'openConnection', r'()Ljava/net/URLConnection;'); - - /// from: public java.net.URLConnection openConnection() - /// The returned object must be released after use, by calling the [release] method. - jni.JObject openConnection() => - const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_openConnection, - jni.JniCallType.objectType, []).object); - - static final _id_openConnection1 = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'openConnection', - r'(Ljava/net/Proxy;)Ljava/net/URLConnection;'); - - /// from: public java.net.URLConnection openConnection(java.net.Proxy proxy) - /// The returned object must be released after use, by calling the [release] method. - jni.JObject openConnection1( - jni.JObject proxy, - ) => - const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_openConnection1, - jni.JniCallType.objectType, - [proxy.reference]).object); - - static final _id_openStream = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'openStream', r'()Ljava/io/InputStream;'); - - /// from: public java.io.InputStream openStream() - /// The returned object must be released after use, by calling the [release] method. - jni.JObject openStream() => - const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_openStream, jni.JniCallType.objectType, []).object); - - static final _id_getContent = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'getContent', r'()Ljava/lang/Object;'); - - /// from: public java.lang.Object getContent() - /// The returned object must be released after use, by calling the [release] method. - jni.JObject getContent() => - const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_getContent, jni.JniCallType.objectType, []).object); - - static final _id_getContent1 = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'getContent', - r'([Ljava/lang/Class;)Ljava/lang/Object;'); - - /// from: public java.lang.Object getContent(java.lang.Class[] classs) - /// The returned object must be released after use, by calling the [release] method. - jni.JObject getContent1( - jni.JArray classs, - ) => - const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_getContent1, - jni.JniCallType.objectType, - [classs.reference]).object); - - static final _id_setURLStreamHandlerFactory = jni.Jni.accessors - .getStaticMethodIDOf(_class.reference, r'setURLStreamHandlerFactory', - r'(Ljava/net/URLStreamHandlerFactory;)V'); - - /// from: static public void setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory uRLStreamHandlerFactory) - static void setURLStreamHandlerFactory( - jni.JObject uRLStreamHandlerFactory, - ) => - jni.Jni.accessors.callStaticMethodWithArgs( - _class.reference, - _id_setURLStreamHandlerFactory, - jni.JniCallType.voidType, - [uRLStreamHandlerFactory.reference]).check(); -} - -class $URLType extends jni.JObjType { - const $URLType(); - - @override - String get signature => r'Ljava/net/URL;'; - - @override - URL fromRef(jni.JObjectPtr ref) => URL.fromRef(ref); - - @override - jni.JObjType get superType => const jni.JObjectType(); - - @override - final superCount = 1; - - @override - int get hashCode => ($URLType).hashCode; - - @override - bool operator ==(Object other) => - other.runtimeType == $URLType && other is $URLType; -} - -/// from: java.nio.Buffer -class Buffer extends jni.JObject { - @override - late final jni.JObjType $type = type; - - Buffer.fromRef( - super.ref, - ) : super.fromRef(); - - static final _class = jni.Jni.findJClass(r'java/nio/Buffer'); - - /// The type which includes information such as the signature of this class. - static const type = $BufferType(); - static final _id_capacity = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'capacity', r'()I'); - - /// from: public final int capacity() - int capacity() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_capacity, jni.JniCallType.intType, []).integer; - - static final _id_position = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'position', r'()I'); - - /// from: public final int position() - int position() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_position, jni.JniCallType.intType, []).integer; - - static final _id_position1 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'position', r'(I)Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer position(int i) - /// The returned object must be released after use, by calling the [release] method. - Buffer position1( - int i, - ) => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_position1, - jni.JniCallType.objectType, - [jni.JValueInt(i)]).object); - - static final _id_limit = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'limit', r'()I'); - - /// from: public final int limit() - int limit() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_limit, jni.JniCallType.intType, []).integer; - - static final _id_limit1 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'limit', r'(I)Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer limit(int i) - /// The returned object must be released after use, by calling the [release] method. - Buffer limit1( - int i, - ) => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_limit1, - jni.JniCallType.objectType, - [jni.JValueInt(i)]).object); - - static final _id_mark = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'mark', r'()Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer mark() - /// The returned object must be released after use, by calling the [release] method. - Buffer mark() => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_mark, jni.JniCallType.objectType, []).object); - - static final _id_reset = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'reset', r'()Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer reset() - /// The returned object must be released after use, by calling the [release] method. - Buffer reset() => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_reset, jni.JniCallType.objectType, []).object); - - static final _id_clear = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'clear', r'()Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer clear() - /// The returned object must be released after use, by calling the [release] method. - Buffer clear() => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_clear, jni.JniCallType.objectType, []).object); - - static final _id_flip = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'flip', r'()Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer flip() - /// The returned object must be released after use, by calling the [release] method. - Buffer flip() => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_flip, jni.JniCallType.objectType, []).object); - - static final _id_rewind = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'rewind', r'()Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer rewind() - /// The returned object must be released after use, by calling the [release] method. - Buffer rewind() => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_rewind, jni.JniCallType.objectType, []).object); - - static final _id_remaining = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'remaining', r'()I'); - - /// from: public final int remaining() - int remaining() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_remaining, jni.JniCallType.intType, []).integer; - - static final _id_hasRemaining = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'hasRemaining', r'()Z'); - - /// from: public final boolean hasRemaining() - bool hasRemaining() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_hasRemaining, jni.JniCallType.booleanType, []).boolean; - - static final _id_isReadOnly = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'isReadOnly', r'()Z'); - - /// from: public abstract boolean isReadOnly() - bool isReadOnly() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_isReadOnly, jni.JniCallType.booleanType, []).boolean; - - static final _id_hasArray = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'hasArray', r'()Z'); - - /// from: public abstract boolean hasArray() - bool hasArray() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_hasArray, jni.JniCallType.booleanType, []).boolean; - - static final _id_array = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'array', r'()Ljava/lang/Object;'); - - /// from: public abstract java.lang.Object array() - /// The returned object must be released after use, by calling the [release] method. - jni.JObject array() => - const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_array, jni.JniCallType.objectType, []).object); - - static final _id_arrayOffset = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'arrayOffset', r'()I'); - - /// from: public abstract int arrayOffset() - int arrayOffset() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_arrayOffset, jni.JniCallType.intType, []).integer; - - static final _id_isDirect = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'isDirect', r'()Z'); - - /// from: public abstract boolean isDirect() - bool isDirect() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_isDirect, jni.JniCallType.booleanType, []).boolean; -} - -class $BufferType extends jni.JObjType { - const $BufferType(); - - @override - String get signature => r'Ljava/nio/Buffer;'; - - @override - Buffer fromRef(jni.JObjectPtr ref) => Buffer.fromRef(ref); - - @override - jni.JObjType get superType => const jni.JObjectType(); - - @override - final superCount = 1; - - @override - int get hashCode => ($BufferType).hashCode; - - @override - bool operator ==(Object other) => - other.runtimeType == $BufferType && other is $BufferType; -} - -/// from: java.nio.ByteBuffer -class ByteBuffer extends Buffer { - @override - late final jni.JObjType $type = type; - - ByteBuffer.fromRef( - super.ref, - ) : super.fromRef(); - - static final _class = jni.Jni.findJClass(r'java/nio/ByteBuffer'); - - /// The type which includes information such as the signature of this class. - static const type = $ByteBufferType(); - static final _id_allocateDirect = jni.Jni.accessors.getStaticMethodIDOf( - _class.reference, r'allocateDirect', r'(I)Ljava/nio/ByteBuffer;'); - - /// from: static public java.nio.ByteBuffer allocateDirect(int i) - /// The returned object must be released after use, by calling the [release] method. - static ByteBuffer allocateDirect( - int i, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors - .callStaticMethodWithArgs(_class.reference, _id_allocateDirect, - jni.JniCallType.objectType, [jni.JValueInt(i)]).object); - - static final _id_allocate = jni.Jni.accessors.getStaticMethodIDOf( - _class.reference, r'allocate', r'(I)Ljava/nio/ByteBuffer;'); - - /// from: static public java.nio.ByteBuffer allocate(int i) - /// The returned object must be released after use, by calling the [release] method. - static ByteBuffer allocate( - int i, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors - .callStaticMethodWithArgs(_class.reference, _id_allocate, - jni.JniCallType.objectType, [jni.JValueInt(i)]).object); - - static final _id_wrap = jni.Jni.accessors.getStaticMethodIDOf( - _class.reference, r'wrap', r'([BII)Ljava/nio/ByteBuffer;'); - - /// from: static public java.nio.ByteBuffer wrap(byte[] bs, int i, int i1) - /// The returned object must be released after use, by calling the [release] method. - static ByteBuffer wrap( - jni.JArray bs, - int i, - int i1, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors - .callStaticMethodWithArgs( - _class.reference, - _id_wrap, - jni.JniCallType.objectType, - [bs.reference, jni.JValueInt(i), jni.JValueInt(i1)]).object); - - static final _id_wrap1 = jni.Jni.accessors.getStaticMethodIDOf( - _class.reference, r'wrap', r'([B)Ljava/nio/ByteBuffer;'); - - /// from: static public java.nio.ByteBuffer wrap(byte[] bs) - /// The returned object must be released after use, by calling the [release] method. - static ByteBuffer wrap1( - jni.JArray bs, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors - .callStaticMethodWithArgs(_class.reference, _id_wrap1, - jni.JniCallType.objectType, [bs.reference]).object); - - static final _id_slice = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'slice', r'()Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer slice() - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer slice() => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_slice, jni.JniCallType.objectType, []).object); - - static final _id_duplicate = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'duplicate', r'()Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer duplicate() - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer duplicate() => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_duplicate, jni.JniCallType.objectType, []).object); - - static final _id_asReadOnlyBuffer = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'asReadOnlyBuffer', r'()Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer asReadOnlyBuffer() - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer asReadOnlyBuffer() => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_asReadOnlyBuffer, - jni.JniCallType.objectType, []).object); - - static final _id_get0 = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'get', r'()B'); - - /// from: public abstract byte get() - int get0() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_get0, jni.JniCallType.byteType, []).byte; - - static final _id_put = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'put', r'(B)Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer put(byte b) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer put( - int b, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_put, - jni.JniCallType.objectType, - [jni.JValueByte(b)]).object); - - static final _id_get1 = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'get', r'(I)B'); - - /// from: public abstract byte get(int i) - int get1( - int i, - ) => - jni.Jni.accessors.callMethodWithArgs(reference, _id_get1, - jni.JniCallType.byteType, [jni.JValueInt(i)]).byte; - - static final _id_put1 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'put', r'(IB)Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer put(int i, byte b) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer put1( - int i, - int b, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_put1, - jni.JniCallType.objectType, - [jni.JValueInt(i), jni.JValueByte(b)]).object); - - static final _id_get2 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'get', r'([BII)Ljava/nio/ByteBuffer;'); - - /// from: public java.nio.ByteBuffer get(byte[] bs, int i, int i1) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer get2( - jni.JArray bs, - int i, - int i1, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_get2, - jni.JniCallType.objectType, - [bs.reference, jni.JValueInt(i), jni.JValueInt(i1)]).object); - - static final _id_get3 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'get', r'([B)Ljava/nio/ByteBuffer;'); - - /// from: public java.nio.ByteBuffer get(byte[] bs) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer get3( - jni.JArray bs, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_get3, - jni.JniCallType.objectType, - [bs.reference]).object); - - static final _id_put2 = jni.Jni.accessors.getMethodIDOf(_class.reference, - r'put', r'(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;'); - - /// from: public java.nio.ByteBuffer put(java.nio.ByteBuffer byteBuffer) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer put2( - ByteBuffer byteBuffer, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_put2, - jni.JniCallType.objectType, - [byteBuffer.reference]).object); - - static final _id_put3 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'put', r'([BII)Ljava/nio/ByteBuffer;'); - - /// from: public java.nio.ByteBuffer put(byte[] bs, int i, int i1) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer put3( - jni.JArray bs, - int i, - int i1, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_put3, - jni.JniCallType.objectType, - [bs.reference, jni.JValueInt(i), jni.JValueInt(i1)]).object); - - static final _id_put4 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'put', r'([B)Ljava/nio/ByteBuffer;'); - - /// from: public final java.nio.ByteBuffer put(byte[] bs) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer put4( - jni.JArray bs, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_put4, - jni.JniCallType.objectType, - [bs.reference]).object); - - static final _id_hasArray = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'hasArray', r'()Z'); - - /// from: public final boolean hasArray() - bool hasArray() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_hasArray, jni.JniCallType.booleanType, []).boolean; - - static final _id_array1 = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'array', r'()[B'); - - /// from: public final byte[] array() - /// The returned object must be released after use, by calling the [release] method. - jni.JArray array1() => const jni.JArrayType(jni.jbyteType()) - .fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_array1, jni.JniCallType.objectType, []).object); - - static final _id_arrayOffset = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'arrayOffset', r'()I'); - - /// from: public final int arrayOffset() - int arrayOffset() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_arrayOffset, jni.JniCallType.intType, []).integer; - - static final _id_position1 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'position', r'(I)Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer position(int i) - /// The returned object must be released after use, by calling the [release] method. - Buffer position1( - int i, - ) => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_position1, - jni.JniCallType.objectType, - [jni.JValueInt(i)]).object); - - static final _id_limit1 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'limit', r'(I)Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer limit(int i) - /// The returned object must be released after use, by calling the [release] method. - Buffer limit1( - int i, - ) => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_limit1, - jni.JniCallType.objectType, - [jni.JValueInt(i)]).object); - - static final _id_mark = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'mark', r'()Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer mark() - /// The returned object must be released after use, by calling the [release] method. - Buffer mark() => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_mark, jni.JniCallType.objectType, []).object); - - static final _id_reset = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'reset', r'()Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer reset() - /// The returned object must be released after use, by calling the [release] method. - Buffer reset() => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_reset, jni.JniCallType.objectType, []).object); - - static final _id_clear = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'clear', r'()Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer clear() - /// The returned object must be released after use, by calling the [release] method. - Buffer clear() => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_clear, jni.JniCallType.objectType, []).object); - - static final _id_flip = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'flip', r'()Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer flip() - /// The returned object must be released after use, by calling the [release] method. - Buffer flip() => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_flip, jni.JniCallType.objectType, []).object); - - static final _id_rewind = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'rewind', r'()Ljava/nio/Buffer;'); - - /// from: public java.nio.Buffer rewind() - /// The returned object must be released after use, by calling the [release] method. - Buffer rewind() => - const $BufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_rewind, jni.JniCallType.objectType, []).object); - - static final _id_compact = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'compact', r'()Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer compact() - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer compact() => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_compact, jni.JniCallType.objectType, []).object); - - static final _id_isDirect = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'isDirect', r'()Z'); - - /// from: public abstract boolean isDirect() - bool isDirect() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_isDirect, jni.JniCallType.booleanType, []).boolean; - - static final _id_toString1 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'toString', r'()Ljava/lang/String;'); - - /// from: public java.lang.String toString() - /// The returned object must be released after use, by calling the [release] method. - jni.JString toString1() => - const jni.JStringType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_toString1, jni.JniCallType.objectType, []).object); - - static final _id_hashCode1 = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'hashCode', r'()I'); - - /// from: public int hashCode() - int hashCode1() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_hashCode1, jni.JniCallType.intType, []).integer; - - static final _id_equals1 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'equals', r'(Ljava/lang/Object;)Z'); - - /// from: public boolean equals(java.lang.Object object) - bool equals1( - jni.JObject object, - ) => - jni.Jni.accessors.callMethodWithArgs(reference, _id_equals1, - jni.JniCallType.booleanType, [object.reference]).boolean; - - static final _id_compareTo = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'compareTo', r'(Ljava/nio/ByteBuffer;)I'); - - /// from: public int compareTo(java.nio.ByteBuffer byteBuffer) - int compareTo( - ByteBuffer byteBuffer, - ) => - jni.Jni.accessors.callMethodWithArgs(reference, _id_compareTo, - jni.JniCallType.intType, [byteBuffer.reference]).integer; - - static final _id_order = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'order', r'()Ljava/nio/ByteOrder;'); - - /// from: public final java.nio.ByteOrder order() - /// The returned object must be released after use, by calling the [release] method. - jni.JObject order() => - const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_order, jni.JniCallType.objectType, []).object); - - static final _id_order1 = jni.Jni.accessors.getMethodIDOf(_class.reference, - r'order', r'(Ljava/nio/ByteOrder;)Ljava/nio/ByteBuffer;'); - - /// from: public final java.nio.ByteBuffer order(java.nio.ByteOrder byteOrder) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer order1( - jni.JObject byteOrder, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_order1, - jni.JniCallType.objectType, - [byteOrder.reference]).object); - - static final _id_alignmentOffset = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'alignmentOffset', r'(II)I'); - - /// from: public final int alignmentOffset(int i, int i1) - int alignmentOffset( - int i, - int i1, - ) => - jni.Jni.accessors.callMethodWithArgs( - reference, - _id_alignmentOffset, - jni.JniCallType.intType, - [jni.JValueInt(i), jni.JValueInt(i1)]).integer; - - static final _id_alignedSlice = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'alignedSlice', r'(I)Ljava/nio/ByteBuffer;'); - - /// from: public final java.nio.ByteBuffer alignedSlice(int i) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer alignedSlice( - int i, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_alignedSlice, - jni.JniCallType.objectType, - [jni.JValueInt(i)]).object); - - static final _id_getChar = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'getChar', r'()C'); - - /// from: public abstract char getChar() - int getChar() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_getChar, jni.JniCallType.charType, []).char; - - static final _id_putChar = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'putChar', r'(C)Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer putChar(char c) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer putChar( - int c, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_putChar, - jni.JniCallType.objectType, - [jni.JValueChar(c)]).object); - - static final _id_getChar1 = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'getChar', r'(I)C'); - - /// from: public abstract char getChar(int i) - int getChar1( - int i, - ) => - jni.Jni.accessors.callMethodWithArgs(reference, _id_getChar1, - jni.JniCallType.charType, [jni.JValueInt(i)]).char; - - static final _id_putChar1 = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'putChar', r'(IC)Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer putChar(int i, char c) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer putChar1( - int i, - int c, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_putChar1, - jni.JniCallType.objectType, - [jni.JValueInt(i), jni.JValueChar(c)]).object); - - static final _id_asCharBuffer = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'asCharBuffer', r'()Ljava/nio/CharBuffer;'); - - /// from: public abstract java.nio.CharBuffer asCharBuffer() - /// The returned object must be released after use, by calling the [release] method. - jni.JObject asCharBuffer() => - const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_asCharBuffer, jni.JniCallType.objectType, []).object); - - static final _id_getShort = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'getShort', r'()S'); - - /// from: public abstract short getShort() - int getShort() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_getShort, jni.JniCallType.shortType, []).short; - - static final _id_putShort = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'putShort', r'(S)Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer putShort(short s) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer putShort( - int s, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_putShort, - jni.JniCallType.objectType, - [jni.JValueShort(s)]).object); - - static final _id_getShort1 = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'getShort', r'(I)S'); - - /// from: public abstract short getShort(int i) - int getShort1( - int i, - ) => - jni.Jni.accessors.callMethodWithArgs(reference, _id_getShort1, - jni.JniCallType.shortType, [jni.JValueInt(i)]).short; - - static final _id_putShort1 = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'putShort', r'(IS)Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer putShort(int i, short s) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer putShort1( - int i, - int s, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_putShort1, - jni.JniCallType.objectType, - [jni.JValueInt(i), jni.JValueShort(s)]).object); - - static final _id_asShortBuffer = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'asShortBuffer', r'()Ljava/nio/ShortBuffer;'); - - /// from: public abstract java.nio.ShortBuffer asShortBuffer() - /// The returned object must be released after use, by calling the [release] method. - jni.JObject asShortBuffer() => - const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_asShortBuffer, jni.JniCallType.objectType, []).object); - - static final _id_getInt = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'getInt', r'()I'); - - /// from: public abstract int getInt() - int getInt() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_getInt, jni.JniCallType.intType, []).integer; - - static final _id_putInt = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'putInt', r'(I)Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer putInt(int i) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer putInt( - int i, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_putInt, - jni.JniCallType.objectType, - [jni.JValueInt(i)]).object); - - static final _id_getInt1 = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'getInt', r'(I)I'); - - /// from: public abstract int getInt(int i) - int getInt1( - int i, - ) => - jni.Jni.accessors.callMethodWithArgs(reference, _id_getInt1, - jni.JniCallType.intType, [jni.JValueInt(i)]).integer; - - static final _id_putInt1 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'putInt', r'(II)Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer putInt(int i, int i1) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer putInt1( - int i, - int i1, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_putInt1, - jni.JniCallType.objectType, - [jni.JValueInt(i), jni.JValueInt(i1)]).object); - - static final _id_asIntBuffer = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'asIntBuffer', r'()Ljava/nio/IntBuffer;'); - - /// from: public abstract java.nio.IntBuffer asIntBuffer() - /// The returned object must be released after use, by calling the [release] method. - jni.JObject asIntBuffer() => - const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_asIntBuffer, jni.JniCallType.objectType, []).object); - - static final _id_getLong = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'getLong', r'()J'); - - /// from: public abstract long getLong() - int getLong() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_getLong, jni.JniCallType.longType, []).long; - - static final _id_putLong = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'putLong', r'(J)Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer putLong(long j) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer putLong( - int j, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_putLong, jni.JniCallType.objectType, [j]).object); - - static final _id_getLong1 = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'getLong', r'(I)J'); - - /// from: public abstract long getLong(int i) - int getLong1( - int i, - ) => - jni.Jni.accessors.callMethodWithArgs(reference, _id_getLong1, - jni.JniCallType.longType, [jni.JValueInt(i)]).long; - - static final _id_putLong1 = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'putLong', r'(IJ)Ljava/nio/ByteBuffer;'); - - /// from: public abstract java.nio.ByteBuffer putLong(int i, long j) - /// The returned object must be released after use, by calling the [release] method. - ByteBuffer putLong1( - int i, - int j, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( + const jni.JStringType().fromRef(jni.Jni.accessors.callMethodWithArgs( reference, - _id_putLong1, - jni.JniCallType.objectType, - [jni.JValueInt(i), j]).object); + _id_toExternalForm, + jni.JniCallType.objectType, []).object); - static final _id_asLongBuffer = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'asLongBuffer', r'()Ljava/nio/LongBuffer;'); + static final _id_toURI = jni.Jni.accessors + .getMethodIDOf(_class.reference, r'toURI', r'()Ljava/net/URI;'); - /// from: public abstract java.nio.LongBuffer asLongBuffer() + /// from: public java.net.URI toURI() /// The returned object must be released after use, by calling the [release] method. - jni.JObject asLongBuffer() => + jni.JObject toURI() => const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_asLongBuffer, jni.JniCallType.objectType, []).object); - - static final _id_getFloat = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'getFloat', r'()F'); - - /// from: public abstract float getFloat() - double getFloat() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_getFloat, jni.JniCallType.floatType, []).float; + reference, _id_toURI, jni.JniCallType.objectType, []).object); - static final _id_putFloat = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'putFloat', r'(F)Ljava/nio/ByteBuffer;'); + static final _id_openConnection = jni.Jni.accessors.getMethodIDOf( + _class.reference, r'openConnection', r'()Ljava/net/URLConnection;'); - /// from: public abstract java.nio.ByteBuffer putFloat(float f) + /// from: public java.net.URLConnection openConnection() /// The returned object must be released after use, by calling the [release] method. - ByteBuffer putFloat( - double f, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( + jni.JObject openConnection() => + const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( reference, - _id_putFloat, - jni.JniCallType.objectType, - [jni.JValueFloat(f)]).object); - - static final _id_getFloat1 = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'getFloat', r'(I)F'); - - /// from: public abstract float getFloat(int i) - double getFloat1( - int i, - ) => - jni.Jni.accessors.callMethodWithArgs(reference, _id_getFloat1, - jni.JniCallType.floatType, [jni.JValueInt(i)]).float; + _id_openConnection, + jni.JniCallType.objectType, []).object); - static final _id_putFloat1 = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'putFloat', r'(IF)Ljava/nio/ByteBuffer;'); + static final _id_openConnection1 = jni.Jni.accessors.getMethodIDOf( + _class.reference, + r'openConnection', + r'(Ljava/net/Proxy;)Ljava/net/URLConnection;'); - /// from: public abstract java.nio.ByteBuffer putFloat(int i, float f) + /// from: public java.net.URLConnection openConnection(java.net.Proxy proxy) /// The returned object must be released after use, by calling the [release] method. - ByteBuffer putFloat1( - int i, - double f, + jni.JObject openConnection1( + jni.JObject proxy, ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( + const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( reference, - _id_putFloat1, + _id_openConnection1, jni.JniCallType.objectType, - [jni.JValueInt(i), jni.JValueFloat(f)]).object); + [proxy.reference]).object); - static final _id_asFloatBuffer = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'asFloatBuffer', r'()Ljava/nio/FloatBuffer;'); + static final _id_openStream = jni.Jni.accessors.getMethodIDOf( + _class.reference, r'openStream', r'()Ljava/io/InputStream;'); - /// from: public abstract java.nio.FloatBuffer asFloatBuffer() + /// from: public java.io.InputStream openStream() /// The returned object must be released after use, by calling the [release] method. - jni.JObject asFloatBuffer() => + jni.JObject openStream() => const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_asFloatBuffer, jni.JniCallType.objectType, []).object); - - static final _id_getDouble = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'getDouble', r'()D'); - - /// from: public abstract double getDouble() - double getDouble() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_getDouble, jni.JniCallType.doubleType, []).doubleFloat; + reference, _id_openStream, jni.JniCallType.objectType, []).object); - static final _id_putDouble = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'putDouble', r'(D)Ljava/nio/ByteBuffer;'); + static final _id_getContent = jni.Jni.accessors + .getMethodIDOf(_class.reference, r'getContent', r'()Ljava/lang/Object;'); - /// from: public abstract java.nio.ByteBuffer putDouble(double d) + /// from: public java.lang.Object getContent() /// The returned object must be released after use, by calling the [release] method. - ByteBuffer putDouble( - double d, - ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_putDouble, jni.JniCallType.objectType, [d]).object); - - static final _id_getDouble1 = - jni.Jni.accessors.getMethodIDOf(_class.reference, r'getDouble', r'(I)D'); - - /// from: public abstract double getDouble(int i) - double getDouble1( - int i, - ) => - jni.Jni.accessors.callMethodWithArgs(reference, _id_getDouble1, - jni.JniCallType.doubleType, [jni.JValueInt(i)]).doubleFloat; + jni.JObject getContent() => + const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( + reference, _id_getContent, jni.JniCallType.objectType, []).object); - static final _id_putDouble1 = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'putDouble', r'(ID)Ljava/nio/ByteBuffer;'); + static final _id_getContent1 = jni.Jni.accessors.getMethodIDOf( + _class.reference, + r'getContent', + r'([Ljava/lang/Class;)Ljava/lang/Object;'); - /// from: public abstract java.nio.ByteBuffer putDouble(int i, double d) + /// from: public java.lang.Object getContent(java.lang.Class[] classs) /// The returned object must be released after use, by calling the [release] method. - ByteBuffer putDouble1( - int i, - double d, + jni.JObject getContent1( + jni.JArray classs, ) => - const $ByteBufferType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, - _id_putDouble1, - jni.JniCallType.objectType, - [jni.JValueInt(i), d]).object); - - static final _id_asDoubleBuffer = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'asDoubleBuffer', r'()Ljava/nio/DoubleBuffer;'); - - /// from: public abstract java.nio.DoubleBuffer asDoubleBuffer() - /// The returned object must be released after use, by calling the [release] method. - jni.JObject asDoubleBuffer() => const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( reference, - _id_asDoubleBuffer, - jni.JniCallType.objectType, []).object); - - static final _id_array = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'array', r'()Ljava/lang/Object;'); - - /// from: public java.lang.Object array() - /// The returned object must be released after use, by calling the [release] method. - jni.JObject array() => - const jni.JObjectType().fromRef(jni.Jni.accessors.callMethodWithArgs( - reference, _id_array, jni.JniCallType.objectType, []).object); + _id_getContent1, + jni.JniCallType.objectType, + [classs.reference]).object); - static final _id_compareTo1 = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'compareTo', r'(Ljava/lang/Object;)I'); + static final _id_setURLStreamHandlerFactory = jni.Jni.accessors + .getStaticMethodIDOf(_class.reference, r'setURLStreamHandlerFactory', + r'(Ljava/net/URLStreamHandlerFactory;)V'); - /// from: public int compareTo(java.lang.Object object) - int compareTo1( - jni.JObject object, + /// from: static public void setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory uRLStreamHandlerFactory) + static void setURLStreamHandlerFactory( + jni.JObject uRLStreamHandlerFactory, ) => - jni.Jni.accessors.callMethodWithArgs(reference, _id_compareTo1, - jni.JniCallType.intType, [object.reference]).integer; + jni.Jni.accessors.callStaticMethodWithArgs( + _class.reference, + _id_setURLStreamHandlerFactory, + jni.JniCallType.voidType, + [uRLStreamHandlerFactory.reference]).check(); } -class $ByteBufferType extends jni.JObjType { - const $ByteBufferType(); +final class $URLType extends jni.JObjType { + const $URLType(); @override - String get signature => r'Ljava/nio/ByteBuffer;'; + String get signature => r'Ljava/net/URL;'; @override - ByteBuffer fromRef(jni.JObjectPtr ref) => ByteBuffer.fromRef(ref); + URL fromRef(jni.JObjectPtr ref) => URL.fromRef(ref); @override - jni.JObjType get superType => const $BufferType(); + jni.JObjType get superType => const jni.JObjectType(); @override - final superCount = 2; + final superCount = 1; @override - int get hashCode => ($ByteBufferType).hashCode; + int get hashCode => ($URLType).hashCode; @override bool operator ==(Object other) => - other.runtimeType == $ByteBufferType && other is $ByteBufferType; + other.runtimeType == $URLType && other is $URLType; } /// from: java.util.concurrent.Executors @@ -2169,7 +1203,7 @@ class Executors extends jni.JObject { [callable.reference]).object); } -class $ExecutorsType extends jni.JObjType { +final class $ExecutorsType extends jni.JObjType { const $ExecutorsType(); @override @@ -2226,7 +1260,7 @@ class CronetEngine_Builder_LibraryLoader extends jni.JObject { jni.JniCallType.voidType, [string.reference]).check(); } -class $CronetEngine_Builder_LibraryLoaderType +final class $CronetEngine_Builder_LibraryLoaderType extends jni.JObjType { const $CronetEngine_Builder_LibraryLoaderType(); @@ -2497,120 +1531,6 @@ class CronetEngine_Builder extends jni.JObject { jni.JniCallType.objectType, [z ? 1 : 0]).object); - static final _id_setThreadPriority = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'setThreadPriority', - r'(I)Lorg/chromium/net/CronetEngine$Builder;'); - - /// from: public org.chromium.net.CronetEngine$Builder setThreadPriority(int i) - /// The returned object must be released after use, by calling the [release] method. - CronetEngine_Builder setThreadPriority( - int i, - ) => - const $CronetEngine_BuilderType().fromRef(jni.Jni.accessors - .callMethodWithArgs(reference, _id_setThreadPriority, - jni.JniCallType.objectType, [jni.JValueInt(i)]).object); - - static final _id_enableNetworkQualityEstimator = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'enableNetworkQualityEstimator', - r'(Z)Lorg/chromium/net/CronetEngine$Builder;'); - - /// from: public org.chromium.net.CronetEngine$Builder enableNetworkQualityEstimator(boolean z) - /// The returned object must be released after use, by calling the [release] method. - CronetEngine_Builder enableNetworkQualityEstimator( - bool z, - ) => - const $CronetEngine_BuilderType().fromRef(jni.Jni.accessors - .callMethodWithArgs(reference, _id_enableNetworkQualityEstimator, - jni.JniCallType.objectType, [z ? 1 : 0]).object); - - static final _id_setQuicOptions = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'setQuicOptions', - r'(Lorg/chromium/net/QuicOptions;)Lorg/chromium/net/CronetEngine$Builder;'); - - /// from: public org.chromium.net.CronetEngine$Builder setQuicOptions(org.chromium.net.QuicOptions quicOptions) - /// The returned object must be released after use, by calling the [release] method. - CronetEngine_Builder setQuicOptions( - jni.JObject quicOptions, - ) => - const $CronetEngine_BuilderType().fromRef(jni.Jni.accessors - .callMethodWithArgs(reference, _id_setQuicOptions, - jni.JniCallType.objectType, [quicOptions.reference]).object); - - static final _id_setQuicOptions1 = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'setQuicOptions', - r'(Lorg/chromium/net/QuicOptions$Builder;)Lorg/chromium/net/CronetEngine$Builder;'); - - /// from: public org.chromium.net.CronetEngine$Builder setQuicOptions(org.chromium.net.QuicOptions$Builder builder) - /// The returned object must be released after use, by calling the [release] method. - CronetEngine_Builder setQuicOptions1( - jni.JObject builder, - ) => - const $CronetEngine_BuilderType().fromRef(jni.Jni.accessors - .callMethodWithArgs(reference, _id_setQuicOptions1, - jni.JniCallType.objectType, [builder.reference]).object); - - static final _id_setDnsOptions = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'setDnsOptions', - r'(Lorg/chromium/net/DnsOptions;)Lorg/chromium/net/CronetEngine$Builder;'); - - /// from: public org.chromium.net.CronetEngine$Builder setDnsOptions(org.chromium.net.DnsOptions dnsOptions) - /// The returned object must be released after use, by calling the [release] method. - CronetEngine_Builder setDnsOptions( - jni.JObject dnsOptions, - ) => - const $CronetEngine_BuilderType().fromRef(jni.Jni.accessors - .callMethodWithArgs(reference, _id_setDnsOptions, - jni.JniCallType.objectType, [dnsOptions.reference]).object); - - static final _id_setDnsOptions1 = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'setDnsOptions', - r'(Lorg/chromium/net/DnsOptions$Builder;)Lorg/chromium/net/CronetEngine$Builder;'); - - /// from: public org.chromium.net.CronetEngine$Builder setDnsOptions(org.chromium.net.DnsOptions$Builder builder) - /// The returned object must be released after use, by calling the [release] method. - CronetEngine_Builder setDnsOptions1( - jni.JObject builder, - ) => - const $CronetEngine_BuilderType().fromRef(jni.Jni.accessors - .callMethodWithArgs(reference, _id_setDnsOptions1, - jni.JniCallType.objectType, [builder.reference]).object); - - static final _id_setConnectionMigrationOptions = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'setConnectionMigrationOptions', - r'(Lorg/chromium/net/ConnectionMigrationOptions;)Lorg/chromium/net/CronetEngine$Builder;'); - - /// from: public org.chromium.net.CronetEngine$Builder setConnectionMigrationOptions(org.chromium.net.ConnectionMigrationOptions connectionMigrationOptions) - /// The returned object must be released after use, by calling the [release] method. - CronetEngine_Builder setConnectionMigrationOptions( - jni.JObject connectionMigrationOptions, - ) => - const $CronetEngine_BuilderType().fromRef(jni.Jni.accessors - .callMethodWithArgs( - reference, - _id_setConnectionMigrationOptions, - jni.JniCallType.objectType, - [connectionMigrationOptions.reference]).object); - - static final _id_setConnectionMigrationOptions1 = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'setConnectionMigrationOptions', - r'(Lorg/chromium/net/ConnectionMigrationOptions$Builder;)Lorg/chromium/net/CronetEngine$Builder;'); - - /// from: public org.chromium.net.CronetEngine$Builder setConnectionMigrationOptions(org.chromium.net.ConnectionMigrationOptions$Builder builder) - /// The returned object must be released after use, by calling the [release] method. - CronetEngine_Builder setConnectionMigrationOptions1( - jni.JObject builder, - ) => - const $CronetEngine_BuilderType().fromRef(jni.Jni.accessors - .callMethodWithArgs(reference, _id_setConnectionMigrationOptions1, - jni.JniCallType.objectType, [builder.reference]).object); - static final _id_build = jni.Jni.accessors.getMethodIDOf( _class.reference, r'build', r'()Lorg/chromium/net/CronetEngine;'); @@ -2621,7 +1541,8 @@ class CronetEngine_Builder extends jni.JObject { reference, _id_build, jni.JniCallType.objectType, []).object); } -class $CronetEngine_BuilderType extends jni.JObjType { +final class $CronetEngine_BuilderType + extends jni.JObjType { const $CronetEngine_BuilderType(); @override @@ -2659,31 +1580,6 @@ class CronetEngine extends jni.JObject { /// The type which includes information such as the signature of this class. static const type = $CronetEngineType(); - - /// from: static public final int ACTIVE_REQUEST_COUNT_UNKNOWN - static const ACTIVE_REQUEST_COUNT_UNKNOWN = -1; - - /// from: static public final int CONNECTION_METRIC_UNKNOWN - static const CONNECTION_METRIC_UNKNOWN = -1; - - /// from: static public final int EFFECTIVE_CONNECTION_TYPE_UNKNOWN - static const EFFECTIVE_CONNECTION_TYPE_UNKNOWN = 0; - - /// from: static public final int EFFECTIVE_CONNECTION_TYPE_OFFLINE - static const EFFECTIVE_CONNECTION_TYPE_OFFLINE = 1; - - /// from: static public final int EFFECTIVE_CONNECTION_TYPE_SLOW_2G - static const EFFECTIVE_CONNECTION_TYPE_SLOW_2G = 2; - - /// from: static public final int EFFECTIVE_CONNECTION_TYPE_2G - static const EFFECTIVE_CONNECTION_TYPE_2G = 3; - - /// from: static public final int EFFECTIVE_CONNECTION_TYPE_3G - static const EFFECTIVE_CONNECTION_TYPE_3G = 4; - - /// from: static public final int EFFECTIVE_CONNECTION_TYPE_4G - static const EFFECTIVE_CONNECTION_TYPE_4G = 5; - static final _id_new0 = jni.Jni.accessors.getMethodIDOf(_class.reference, r'', r'()V'); @@ -2785,168 +1681,9 @@ class CronetEngine extends jni.JObject { callback.reference, executor.reference ]).object); - - static final _id_getActiveRequestCount = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'getActiveRequestCount', r'()I'); - - /// from: public int getActiveRequestCount() - int getActiveRequestCount() => jni.Jni.accessors.callMethodWithArgs(reference, - _id_getActiveRequestCount, jni.JniCallType.intType, []).integer; - - static final _id_addRequestFinishedListener = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'addRequestFinishedListener', - r'(Lorg/chromium/net/RequestFinishedInfo$Listener;)V'); - - /// from: public void addRequestFinishedListener(org.chromium.net.RequestFinishedInfo$Listener listener) - void addRequestFinishedListener( - jni.JObject listener, - ) => - jni.Jni.accessors.callMethodWithArgs( - reference, - _id_addRequestFinishedListener, - jni.JniCallType.voidType, - [listener.reference]).check(); - - static final _id_removeRequestFinishedListener = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'removeRequestFinishedListener', - r'(Lorg/chromium/net/RequestFinishedInfo$Listener;)V'); - - /// from: public void removeRequestFinishedListener(org.chromium.net.RequestFinishedInfo$Listener listener) - void removeRequestFinishedListener( - jni.JObject listener, - ) => - jni.Jni.accessors.callMethodWithArgs( - reference, - _id_removeRequestFinishedListener, - jni.JniCallType.voidType, - [listener.reference]).check(); - - static final _id_getHttpRttMs = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'getHttpRttMs', r'()I'); - - /// from: public int getHttpRttMs() - int getHttpRttMs() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_getHttpRttMs, jni.JniCallType.intType, []).integer; - - static final _id_getTransportRttMs = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'getTransportRttMs', r'()I'); - - /// from: public int getTransportRttMs() - int getTransportRttMs() => jni.Jni.accessors.callMethodWithArgs( - reference, _id_getTransportRttMs, jni.JniCallType.intType, []).integer; - - static final _id_getDownstreamThroughputKbps = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'getDownstreamThroughputKbps', r'()I'); - - /// from: public int getDownstreamThroughputKbps() - int getDownstreamThroughputKbps() => jni.Jni.accessors.callMethodWithArgs( - reference, - _id_getDownstreamThroughputKbps, - jni.JniCallType.intType, []).integer; - - static final _id_startNetLogToDisk = jni.Jni.accessors.getMethodIDOf( - _class.reference, r'startNetLogToDisk', r'(Ljava/lang/String;ZI)V'); - - /// from: public void startNetLogToDisk(java.lang.String string, boolean z, int i) - void startNetLogToDisk( - jni.JString string, - bool z, - int i, - ) => - jni.Jni.accessors.callMethodWithArgs( - reference, - _id_startNetLogToDisk, - jni.JniCallType.voidType, - [string.reference, z ? 1 : 0, jni.JValueInt(i)]).check(); - - static final _id_getEffectiveConnectionType = jni.Jni.accessors - .getMethodIDOf(_class.reference, r'getEffectiveConnectionType', r'()I'); - - /// from: public int getEffectiveConnectionType() - int getEffectiveConnectionType() => jni.Jni.accessors.callMethodWithArgs( - reference, - _id_getEffectiveConnectionType, - jni.JniCallType.intType, []).integer; - - static final _id_configureNetworkQualityEstimatorForTesting = - jni.Jni.accessors.getMethodIDOf(_class.reference, - r'configureNetworkQualityEstimatorForTesting', r'(ZZZ)V'); - - /// from: public void configureNetworkQualityEstimatorForTesting(boolean z, boolean z1, boolean z2) - void configureNetworkQualityEstimatorForTesting( - bool z, - bool z1, - bool z2, - ) => - jni.Jni.accessors.callMethodWithArgs( - reference, - _id_configureNetworkQualityEstimatorForTesting, - jni.JniCallType.voidType, - [z ? 1 : 0, z1 ? 1 : 0, z2 ? 1 : 0]).check(); - - static final _id_addRttListener = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'addRttListener', - r'(Lorg/chromium/net/NetworkQualityRttListener;)V'); - - /// from: public void addRttListener(org.chromium.net.NetworkQualityRttListener networkQualityRttListener) - void addRttListener( - jni.JObject networkQualityRttListener, - ) => - jni.Jni.accessors.callMethodWithArgs( - reference, - _id_addRttListener, - jni.JniCallType.voidType, - [networkQualityRttListener.reference]).check(); - - static final _id_removeRttListener = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'removeRttListener', - r'(Lorg/chromium/net/NetworkQualityRttListener;)V'); - - /// from: public void removeRttListener(org.chromium.net.NetworkQualityRttListener networkQualityRttListener) - void removeRttListener( - jni.JObject networkQualityRttListener, - ) => - jni.Jni.accessors.callMethodWithArgs( - reference, - _id_removeRttListener, - jni.JniCallType.voidType, - [networkQualityRttListener.reference]).check(); - - static final _id_addThroughputListener = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'addThroughputListener', - r'(Lorg/chromium/net/NetworkQualityThroughputListener;)V'); - - /// from: public void addThroughputListener(org.chromium.net.NetworkQualityThroughputListener networkQualityThroughputListener) - void addThroughputListener( - jni.JObject networkQualityThroughputListener, - ) => - jni.Jni.accessors.callMethodWithArgs( - reference, - _id_addThroughputListener, - jni.JniCallType.voidType, - [networkQualityThroughputListener.reference]).check(); - - static final _id_removeThroughputListener = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'removeThroughputListener', - r'(Lorg/chromium/net/NetworkQualityThroughputListener;)V'); - - /// from: public void removeThroughputListener(org.chromium.net.NetworkQualityThroughputListener networkQualityThroughputListener) - void removeThroughputListener( - jni.JObject networkQualityThroughputListener, - ) => - jni.Jni.accessors.callMethodWithArgs( - reference, - _id_removeThroughputListener, - jni.JniCallType.voidType, - [networkQualityThroughputListener.reference]).check(); } -class $CronetEngineType extends jni.JObjType { +final class $CronetEngineType extends jni.JObjType { const $CronetEngineType(); @override @@ -2997,7 +1734,7 @@ class CronetException extends jni.JObject { [string.reference, throwable.reference]).object); } -class $CronetExceptionType extends jni.JObjType { +final class $CronetExceptionType extends jni.JObjType { const $CronetExceptionType(); @override @@ -3074,7 +1811,7 @@ class UploadDataProviders extends jni.JObject { /// from: static public org.chromium.net.UploadDataProvider create(java.nio.ByteBuffer byteBuffer) /// The returned object must be released after use, by calling the [release] method. static jni.JObject create2( - ByteBuffer byteBuffer, + jni.JByteBuffer byteBuffer, ) => const jni.JObjectType().fromRef(jni.Jni.accessors .callStaticMethodWithArgs(_class.reference, _id_create2, @@ -3114,7 +1851,7 @@ class UploadDataProviders extends jni.JObject { jni.JniCallType.objectType, [bs.reference]).object); } -class $UploadDataProvidersType extends jni.JObjType { +final class $UploadDataProvidersType extends jni.JObjType { const $UploadDataProvidersType(); @override @@ -3263,62 +2000,6 @@ class UrlRequest_Builder extends jni.JObject { .fromRef(jni.Jni.accessors.callMethodWithArgs(reference, _id_allowDirectExecutor, jni.JniCallType.objectType, []).object); - static final _id_addRequestAnnotation = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'addRequestAnnotation', - r'(Ljava/lang/Object;)Lorg/chromium/net/UrlRequest$Builder;'); - - /// from: public org.chromium.net.UrlRequest$Builder addRequestAnnotation(java.lang.Object object) - /// The returned object must be released after use, by calling the [release] method. - UrlRequest_Builder addRequestAnnotation( - jni.JObject object, - ) => - const $UrlRequest_BuilderType().fromRef(jni.Jni.accessors - .callMethodWithArgs(reference, _id_addRequestAnnotation, - jni.JniCallType.objectType, [object.reference]).object); - - static final _id_setTrafficStatsTag = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'setTrafficStatsTag', - r'(I)Lorg/chromium/net/UrlRequest$Builder;'); - - /// from: public org.chromium.net.UrlRequest$Builder setTrafficStatsTag(int i) - /// The returned object must be released after use, by calling the [release] method. - UrlRequest_Builder setTrafficStatsTag( - int i, - ) => - const $UrlRequest_BuilderType().fromRef(jni.Jni.accessors - .callMethodWithArgs(reference, _id_setTrafficStatsTag, - jni.JniCallType.objectType, [jni.JValueInt(i)]).object); - - static final _id_setTrafficStatsUid = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'setTrafficStatsUid', - r'(I)Lorg/chromium/net/UrlRequest$Builder;'); - - /// from: public org.chromium.net.UrlRequest$Builder setTrafficStatsUid(int i) - /// The returned object must be released after use, by calling the [release] method. - UrlRequest_Builder setTrafficStatsUid( - int i, - ) => - const $UrlRequest_BuilderType().fromRef(jni.Jni.accessors - .callMethodWithArgs(reference, _id_setTrafficStatsUid, - jni.JniCallType.objectType, [jni.JValueInt(i)]).object); - - static final _id_setRequestFinishedListener = jni.Jni.accessors.getMethodIDOf( - _class.reference, - r'setRequestFinishedListener', - r'(Lorg/chromium/net/RequestFinishedInfo$Listener;)Lorg/chromium/net/UrlRequest$Builder;'); - - /// from: public org.chromium.net.UrlRequest$Builder setRequestFinishedListener(org.chromium.net.RequestFinishedInfo$Listener listener) - /// The returned object must be released after use, by calling the [release] method. - UrlRequest_Builder setRequestFinishedListener( - jni.JObject listener, - ) => - const $UrlRequest_BuilderType().fromRef(jni.Jni.accessors - .callMethodWithArgs(reference, _id_setRequestFinishedListener, - jni.JniCallType.objectType, [listener.reference]).object); - static final _id_build = jni.Jni.accessors.getMethodIDOf( _class.reference, r'build', r'()Lorg/chromium/net/UrlRequest;'); @@ -3329,7 +2010,7 @@ class UrlRequest_Builder extends jni.JObject { reference, _id_build, jni.JniCallType.objectType, []).object); } -class $UrlRequest_BuilderType extends jni.JObjType { +final class $UrlRequest_BuilderType extends jni.JObjType { const $UrlRequest_BuilderType(); @override @@ -3419,7 +2100,7 @@ class UrlRequest_Callback extends jni.JObject { void onReadCompleted( UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, - ByteBuffer byteBuffer, + jni.JByteBuffer byteBuffer, ) => jni.Jni.accessors.callMethodWithArgs( reference, _id_onReadCompleted, jni.JniCallType.voidType, [ @@ -3479,7 +2160,7 @@ class UrlRequest_Callback extends jni.JObject { [urlRequest.reference, urlResponseInfo.reference]).check(); } -class $UrlRequest_CallbackType extends jni.JObjType { +final class $UrlRequest_CallbackType extends jni.JObjType { const $UrlRequest_CallbackType(); @override @@ -3568,7 +2249,7 @@ class UrlRequest_Status extends jni.JObject { static const READING_RESPONSE = 14; } -class $UrlRequest_StatusType extends jni.JObjType { +final class $UrlRequest_StatusType extends jni.JObjType { const $UrlRequest_StatusType(); @override @@ -3627,7 +2308,7 @@ class UrlRequest_StatusListener extends jni.JObject { jni.JniCallType.voidType, [jni.JValueInt(i)]).check(); } -class $UrlRequest_StatusListenerType +final class $UrlRequest_StatusListenerType extends jni.JObjType { const $UrlRequest_StatusListenerType(); @@ -3693,7 +2374,7 @@ class UrlRequest extends jni.JObject { /// from: public abstract void read(java.nio.ByteBuffer byteBuffer) void read( - ByteBuffer byteBuffer, + jni.JByteBuffer byteBuffer, ) => jni.Jni.accessors.callMethodWithArgs(reference, _id_read, jni.JniCallType.voidType, [byteBuffer.reference]).check(); @@ -3723,7 +2404,7 @@ class UrlRequest extends jni.JObject { jni.JniCallType.voidType, [statusListener.reference]).check(); } -class $UrlRequestType extends jni.JObjType { +final class $UrlRequestType extends jni.JObjType { const $UrlRequestType(); @override @@ -3789,7 +2470,7 @@ class UrlResponseInfo_HeaderBlock extends jni.JObject { reference, _id_getAsMap, jni.JniCallType.objectType, []).object); } -class $UrlResponseInfo_HeaderBlockType +final class $UrlResponseInfo_HeaderBlockType extends jni.JObjType { const $UrlResponseInfo_HeaderBlockType(); @@ -3929,7 +2610,7 @@ class UrlResponseInfo extends jni.JObject { reference, _id_getReceivedByteCount, jni.JniCallType.longType, []).long; } -class $UrlResponseInfoType extends jni.JObjType { +final class $UrlResponseInfoType extends jni.JObjType { const $UrlResponseInfoType(); @override diff --git a/pkgs/cronet_http/pubspec.yaml b/pkgs/cronet_http/pubspec.yaml index 129547c1aa..80d13015d6 100644 --- a/pkgs/cronet_http/pubspec.yaml +++ b/pkgs/cronet_http/pubspec.yaml @@ -1,7 +1,7 @@ name: cronet_http description: > An Android Flutter plugin that provides access to the Cronet HTTP client. -version: 0.3.0-jni +version: 0.4.0-jni repository: https://github.com/dart-lang/http/tree/master/pkgs/cronet_http environment: @@ -12,11 +12,11 @@ dependencies: flutter: sdk: flutter http: '>=0.13.4 <2.0.0' - jni: ^0.6.1 + jni: ^0.7.0 dev_dependencies: dart_flutter_team_lints: ^1.0.0 - jnigen: ^0.6.0 + jnigen: ^0.7.0 xml: ^6.1.0 yaml_edit: ^2.0.3