LocaleManager.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:Phoenicia 作者:
/**
 * Identify available locales
 * @param locales_directory
 * @return
 */
public Map<String, String> scan(String locales_directory) throws IOException {
    final Map<String, String> locale_map = new HashMap<String, String>();

    String[] files = PhoeniciaContext.assetManager.list(locales_directory);
    for (String locale_dir: files) {
        if (locale_dir.equals("common")) continue;
        String locale_path = locales_directory+"/"+locale_dir+"/manifest.xml";
        LocaleHeaderScanner scanner = new LocaleHeaderScanner(locale_path, locale_map);
        try {
            InputStream locale_manifest_in = PhoeniciaContext.assetManager.open(locale_path);
            final SAXParserFactory spf = SAXParserFactory.newInstance();
            final SAXParser sp = spf.newSAXParser();
            final XMLReader xr = sp.getXMLReader();
            xr.setContentHandler(scanner);
            xr.parse(new InputSource(new BufferedInputStream(locale_manifest_in)));
        } catch (Exception e) {
            Debug.e(e);
        }
    }
    return locale_map;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号