借花献佛,tongyu75写的,帖子出处http://topic.csdn.net/u/20100415/09/e5434851-6bde-4ba1-bdbe-dd7dc622ac6b.html?seed=425312877&r=64680621#r_64680621
try {
AssetManager a = getAssets();
InputStream inputStream = a.open("1.txt");
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
byte[] bytes = new byte[1];
while(inputStream.read(bytes) != -1) {
arrayOutputStream.write(bytes);
}
arrayOutputStream.close();
inputStream.close(); } catch(IOException e){
System.out.println("文件有误Erroe");
}
try {
AssetManager a = getAssets();
InputStream inputStream = a.open("1.txt");
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
byte[] bytes = new byte[1];
while(inputStream.read(bytes) != -1) {
arrayOutputStream.write(bytes);
}
arrayOutputStream.close();
inputStream.close(); } catch(IOException e){
System.out.println("文件有误Erroe");
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货