@Implementation(minSdk = P)
  protected static int nativeAssetRead(long asset_ptr, byte[] java_buffer, int offset, int len)
      throws IOException {
    if (len == 0) {
      return 0;
    }

    int buffer_len = java_buffer.length;
    if (offset < 0 || offset >= buffer_len || len < 0 || len > buffer_len ||
        offset > buffer_len - len) {
      throw new IndexOutOfBoundsException();
    }

    // ScopedByteArrayRW byte_array(env, java_buffer);
    // if (byte_array.get() == null) {
    //   return -1;
    // }

    Asset asset = Registries.NATIVE_ASSET_REGISTRY.getNativeObject(asset_ptr);
    // sint res = asset.read(byte_array.get() + offset, len);
    int res = asset.read(java_buffer, offset, len);
    if (res < 0) {
      throw new IOException();
    }
    return res > 0 ? (int) (res) : -1;
  }
@Implementation(minSdk = P)
  protected static int nativeAssetRead(long asset_ptr, byte[] java_buffer, int offset, int len)
      throws IOException {
    if (len == 0) {
      return 0;
    }

    int buffer_len = java_buffer.length;
    if (offset < 0 || offset >= buffer_len || len < 0 || len > buffer_len ||
        offset > buffer_len - len) {
      throw new IndexOutOfBoundsException();
    }

    
    
    
    

    Asset asset = Registries.NATIVE_ASSET_REGISTRY.getNativeObject(asset_ptr);
    
    int res = asset.read(java_buffer, offset, len);
    if (res < 0) {
      throw new IOException();
    }
    return res > 0 ? (int) (res) : -1;
  }
@ Implementation ( minSdk = P ) protected static int nativeAssetRead ( long asset_ptr , byte [ ] java_buffer , int offset , int len ) throws IOException { if ( len == 0 ) { return 0 ; } int buffer_len = java_buffer . length ; if ( offset < 0 || offset >= buffer_len || len < 0 || len > buffer_len || offset > buffer_len - len ) { throw new IndexOutOfBoundsException ( ) ; } // ScopedByteArrayRW byte_array(env, java_buffer); // if (byte_array.get() == null) { //   return -1; // } Asset asset = Registries . NATIVE_ASSET_REGISTRY . getNativeObject ( asset_ptr ) ; // sint res = asset.read(byte_array.get() + offset, len); int res = asset . read ( java_buffer , offset , len ) ; if ( res < 0 ) { throw new IOException ( ) ; } return res > 0 ? ( int ) ( res ) : - 1 ; }
jint offset, jint len) {
jint offset jint len ) {