/** * Retrieve a parser for a compiled XML file. * * @param cookie Identifier of the package to be opened. * @param fileName The name of the file to retrieve. */ public final XmlResourceParser openXmlResourceParser(int cookie, String fileName) throws IOException { XmlBlock block = openXmlBlockAsset(cookie, fileName); XmlResourceParser rp = block.newParser(); block.close(); return rp; }
/** * {@hide} Retrieve a non-asset as a compiled XML file. Not for use by applications. * * @param cookie Identifier of the package to be opened. * @param fileName Name of the asset to retrieve. */ /*package*/ final XmlBlock openXmlBlockAsset(int cookie, String fileName) throws IOException { synchronized (this) { if (!mOpen) { throw new RuntimeException("Assetmanager has been closed"); } long xmlBlock = openXmlAssetNative(cookie, fileName); if (xmlBlock != 0) { XmlBlock res = new XmlBlock(this, xmlBlock); incRefsLocked(res.hashCode()); return res; } } throw new FileNotFoundException("Asset XML file: " + fileName); }