java下载文件到本地打开出现乱码

mataofq 2011-02-25 03:36:43
下载文件到本地,mp3文件正常播放,lrc文件全部乱码!求解~~
public File write2SDFromInput(String path, String fileName, InputStream input){
File file = null;
OutputStream output = null;
try {
createSDDir(path);
file = createFileInSDCard(fileName, path);
output = new FileOutputStream(file);
byte[] buffer = new byte[8*1024];
int temp;
while ((temp = input.read(buffer)) != -1) {
output.write(buffer, 0, temp);
Log.d("mt", "buffer -->" + buffer.toString());
}
output.flush();
} catch (Exception e) {
e.printStackTrace();
}
finally{
try {
output.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
return file;
}
...全文
613 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
小恩yoo 2012-04-08
  • 打赏
  • 举报
回复
将InputStream 里面的数据存入到sd卡中
mataofq 2011-02-25
  • 打赏
  • 举报
回复
不是通过网页的形式下载的啊

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧