xiatian 5 ani în urmă
părinte
comite
072d54c131

+ 9 - 2
src/main/java/cn/com/qmth/examcloud/web/filestorage/FileStorageUtil.java

@@ -196,10 +196,9 @@ public class FileStorageUtil {
 	 *
 	 * @param fileUrl       网络文件URL
 	 * @param localFilePath 例如D:/123.txt
-	 * @return
 	 * @throws IOException
 	 */
-	private static void saveUrlAs(String fileUrl, String localFilePath) throws IOException {
+	public static void saveUrlAs(String fileUrl, String localFilePath) throws IOException {
 		URL url = new URL(fileUrl);
 
 		HttpURLConnection connection;
@@ -222,6 +221,14 @@ public class FileStorageUtil {
 			}
 		}
 	}
+	/**将网络文件保存到本地
+	 * @param fileUrl 网络文件URL
+	 * @param localFile  本地文件对象
+	 * @throws IOException
+	 */
+	public static void saveUrlAs(String fileUrl, File localFile) throws IOException {
+		saveUrlAs(fileUrl, localFile.getAbsoluteFile());
+	}
 
 	/**获取指定云存储的签名
 	 * @param siteId