提交 617e4e73 authored 作者: 艾庆国's avatar 艾庆国

代码优化

上级 330547c9
...@@ -68,15 +68,19 @@ public class NbBankThirdpartyServiceImpl implements NbBankThirdpartyService { ...@@ -68,15 +68,19 @@ public class NbBankThirdpartyServiceImpl implements NbBankThirdpartyService {
private static void downloadUsingStream(String urlStr, String file) throws IOException { private static void downloadUsingStream(String urlStr, String file) throws IOException {
URL url = new URL(urlStr); URL url = new URL(urlStr);
BufferedInputStream bis = new BufferedInputStream(url.openStream()); BufferedInputStream bis = new BufferedInputStream(url.openStream());
FileOutputStream fis = new FileOutputStream(file); FileOutputStream fis = null;
byte[] buffer = new byte[1024]; try {
int count=0; fis = new FileOutputStream(file);
while((count = bis.read(buffer,0,1024)) != -1) byte[] buffer = new byte[1024];
{ int count = 0;
fis.write(buffer, 0, count); while ((count = bis.read(buffer, 0, 1024)) != -1) {
fis.write(buffer, 0, count);
}
}finally {
fis.close();
bis.close();
} }
fis.close();
bis.close();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论