@Implementation
  protected static long nativeOpenXml(long ptr, String file_name) throws FileNotFoundException {
    String path_utf8 = file_name;
    if (path_utf8 == null) {
      return 0;
    }

    CppApkAssets apk_assets =
        Registries.NATIVE_APK_ASSETS_REGISTRY.getNativeObject(ptr);
    Asset asset = apk_assets.Open(path_utf8,
        Asset.AccessMode.ACCESS_RANDOM);
    if (asset == null) {
      throw new FileNotFoundException(path_utf8);
    }

    // DynamicRefTable is only needed when looking up resource references. Opening an XML file
    // directly from an ApkAssets has no notion of proper resource references.
    ResXMLTree xml_tree = new ResXMLTree(null); // util.make_unique<ResXMLTree>(nullptr /*dynamicRefTable*/);
    int err = xml_tree.setTo(asset.getBuffer(true), (int) asset.getLength(), true);
    // asset.reset();

    if (err != NO_ERROR) {
      throw new FileNotFoundException("Corrupt XML binary file");
    }
    return Registries.NATIVE_RES_XML_TREES.register(xml_tree); // reinterpret_cast<jlong>(xml_tree.release());
  }
@Implementation
  protected static long nativeOpenXml(long ptr, String file_name) throws FileNotFoundException {
    String path_utf8 = file_name;
    if (path_utf8 == null) {
      return 0;
    }

    CppApkAssets apk_assets =
        Registries.NATIVE_APK_ASSETS_REGISTRY.getNativeObject(ptr);
    Asset asset = apk_assets.Open(path_utf8,
        Asset.AccessMode.ACCESS_RANDOM);
    if (asset == null) {
      throw new FileNotFoundException(path_utf8);
    }

    
    
    ResXMLTree xml_tree = new ResXMLTree(null); 
    int err = xml_tree.setTo(asset.getBuffer(true), (int) asset.getLength(), true);
    

    if (err != NO_ERROR) {
      throw new FileNotFoundException("Corrupt XML binary file");
    }
    return Registries.NATIVE_RES_XML_TREES.register(xml_tree); 
  }
@ Implementation protected static long nativeOpenXml ( long ptr , String file_name ) throws FileNotFoundException { String path_utf8 = file_name ; if ( path_utf8 == null ) { return 0 ; } CppApkAssets apk_assets = Registries . NATIVE_APK_ASSETS_REGISTRY . getNativeObject ( ptr ) ; Asset asset = apk_assets . Open ( path_utf8 , Asset . AccessMode . ACCESS_RANDOM ) ; if ( asset == null ) { throw new FileNotFoundException ( path_utf8 ) ; } // DynamicRefTable is only needed when looking up resource references. Opening an XML file // directly from an ApkAssets has no notion of proper resource references. ResXMLTree xml_tree = new ResXMLTree ( null ) ; // util.make_unique<ResXMLTree>(nullptr /*dynamicRefTable*/); int err = xml_tree . setTo ( asset . getBuffer ( true ) , ( int ) asset . getLength ( ) , true ) ; // asset.reset(); if ( err != NO_ERROR ) { throw new FileNotFoundException ( "Corrupt XML binary file" ) ; } return Registries . NATIVE_RES_XML_TREES . register ( xml_tree ) ; // reinterpret_cast<jlong>(xml_tree.release()); }
static jlong NativeOpenXml(JNIEnv* env, jclass /*clazz*/, jlong ptr, jstring file_name) {
static jlong NativeOpenXml ( JNIEnv * env jclass / * clazz * / jlong ptr jstring file_name ) {