下载到SD卡文件

inputStream = conn.getInputStream();


byte[] buffer = new byte[1024];
int len = -1;
File f = new File(Util.savePath + "/" + "meituan_xml");
if (!f.exists())
f.createNewFile();
OutputStream output = new FileOutputStream(f);


while ((len = inputStream.read(buffer)) != -1) {
output.write(buffer, 0, len);                                             //注意要写3个参数
}


output.flush();
output.close();
inputStream.close();




你可能感兴趣的:(xml,File,buffer,byte,output)