读取android目录下本地文件

来源:互联网 发布:淘宝怎么搜爱弹幕账号 编辑:程序博客网 时间:2024/05/19 19:13

读取本地文件

   private String getAppList() {

        String rawData = null;
        InputStream inputStream = mContext.getResources().openRawResource(
                R.raw.loacl_app);
        try {
            int lenght = inputStream.available();
            byte[] buffer = new byte[lenght];
            inputStream.read(buffer);
            rawData = EncodingUtils.getString(buffer, "UTF-8");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return rawData;
    }

xxxx/res/raw/loacl_app 文件内容

[

    AppInfo[
        id=28,
        title=快牙,
        packageName=com.dewmobile.kuaiya,
        icon=http: //192.168.1.1: 88/img/0a/44/0a44116e2a3d9cfe08508fc4eeb933be.png,
        version=v2.4(CN),
        desc=,
        update_time=2014-04-30,
        size=3.52M,
        installs=19735245,
        screen=,
        link_url=[
            http: //bbx2.sj.91.com/softs.ashx?act=207&resId=4063261120&resName=%e5%bf%ab%e7%89%99ZAPYA&versionName=v2.4%20(CN)&icon=http%3a%2f%2fimg5.sjpic.91rb.com%2fsoft%2f2014%2f4%2f30%2f47f7c188e531040f2b4b4e00d7f2874cc%2ficon_8cefe1e4e89a4398ba587e31680d04bc_175.png&cateName=%e6%96%87%e6%a1%a3%e5%a4%84%e7%90%86&size=3.52MB&fsize=3690045&identifer=com.dewmobile.kuaiya&resType=1&versionCode=101&score=0&thunder=0&placeId=121012284&mt=4&sv=1.0.0&pid=2&osv=&price=0.00&pos=5
        ]

    ],

]

0 0
原创粉丝点击