Przeglądaj źródła

优化下载文件

java110 6 lat temu
rodzic
commit
980acbaa9a

+ 3 - 2
java110-core/src/main/java/com/java110/core/client/FtpUploadTemplate.java

@@ -226,9 +226,10 @@ public class FtpUploadTemplate {
             String f = new String(
             String f = new String(
                     (remotePath + fileName).getBytes("GBK"),
                     (remotePath + fileName).getBytes("GBK"),
                     FTP.DEFAULT_CONTROL_ENCODING);
                     FTP.DEFAULT_CONTROL_ENCODING);
-            is = ftpClient.retrieveFileStream(f);// 获取远程ftp上指定文件的InputStream
+            ftpClient.changeWorkingDirectory(remotePath);
+            is = ftpClient.retrieveFileStream(fileName);// 获取远程ftp上指定文件的InputStream
             if (null == is) {
             if (null == is) {
-                throw new FileNotFoundException(f);
+                throw new FileNotFoundException(remotePath);
             }
             }
             bos = new ByteArrayOutputStream();
             bos = new ByteArrayOutputStream();
             int length;
             int length;