项目中的Asset的读取;

来源:互联网 发布:淘宝客服沟通技巧ppt 编辑:程序博客网 时间:2024/05/17 04:42

Assest 只能读取,不能写入;


assest的读取:



text就是youxi.txt中的数据;


InputStream inputStream = MainActivity.this.getAssets().open(
"youxi.txt");
int size = inputStream.available();
byte[] buffer = new byte[size];
inputStream.read(buffer);
inputStream.close();
String text = new String(buffer, "GB2312");

0 0
原创粉丝点击