/**
* 文件下载
*
* @param destination 下载路径 D:\\ddd.pdf
* @param input 文件流
* @throws IOException
*/
public 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();
}
input.close();
downloadFile.close();
}
文件下载到本地
最新推荐文章于 2025-04-04 19:00:02 发布