优化下载功能
This commit is contained in:
@@ -80,6 +80,7 @@ public class FileTransformation {
|
||||
* @return
|
||||
*/
|
||||
public static boolean downLoadFileByUrl(String httpUrl, String dir) throws EsignDemoException {
|
||||
boolean downLoadFileFlag = false;
|
||||
InputStream fis = null;
|
||||
FileOutputStream fileOutputStream = null;
|
||||
try {
|
||||
@@ -95,10 +96,17 @@ public class FileTransformation {
|
||||
while ((length = fis.read(buffer, 0, 1024)) != -1) {
|
||||
fileOutputStream.write(buffer, 0, length);
|
||||
}
|
||||
downLoadFileFlag = true;
|
||||
|
||||
System.out.println("下载签署裁决书,downLoadFileFlag:--------------" +downLoadFileFlag);
|
||||
|
||||
} catch (IOException e) {
|
||||
EsignDemoException ex = new EsignDemoException("获取文件流异常", e);
|
||||
ex.initCause(e);
|
||||
throw ex;
|
||||
|
||||
System.out.println("下载签署裁决书,downLoadFileFlag:--------------" +downLoadFileFlag);
|
||||
|
||||
return downLoadFileFlag;
|
||||
} finally {
|
||||
try {
|
||||
if (fis != null) {
|
||||
@@ -110,10 +118,13 @@ public class FileTransformation {
|
||||
} catch (IOException e) {
|
||||
EsignDemoException ex = new EsignDemoException("关闭文件流异常", e);
|
||||
ex.initCause(e);
|
||||
throw ex;
|
||||
|
||||
System.out.println("下载签署裁决书,downLoadFileFlag:--------------" +downLoadFileFlag);
|
||||
|
||||
return downLoadFileFlag;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return downLoadFileFlag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user