http://blog.csdn.net/hgg923/article/details/50698858
/**
* 将InputStream写入本地文件
* @param destination 写入本地目录
* @param input 输入流
* @throws IOException
*/
private static void writeToLocal(String destination, InputStream input)
throws IOException {
int index;
byte[] bytes = new byte[1024];
FileOutputStream downloadFile = new FileOutputStream(destination);
while ((index = input.read(bytes)) != -1) {
downloadFile.write(bytes, 0, index);
downloadFile.flush();
}
downloadFile.close();
input.close();
}
---------------------
作者:多来哈米
来源:CSDN
原文:https://blog.csdn.net/hgg923/article/details/50698858
版权声明:本文为博主原创文章,转载请附上博文链接!