合并分支 'dev_third_stage' 到 'master'

Dev third stage

查看合并请求 laws-nio/laws-weilai!83
This commit is contained in:
肖文钰
2022-07-14 15:38:23 +08:00
73 changed files with 3189 additions and 507 deletions
@@ -0,0 +1,34 @@
package com.jero.common.util;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
public class FileUtils {
/**
* 复制文件
* @param in
* @param newFile
* @throws IOException
*/
public static void copyFile(InputStream in, String newFile) throws IOException {
File file2 = new File(newFile);
if (!file2.exists()) {
file2.createNewFile();
}
try (FileOutputStream ou = new FileOutputStream(newFile);) {
byte[] bs = new byte[1024];
int count = 0;
while ((count = in.read(bs, 0, bs.length)) != -1) {
ou.write(bs, 0, count);
}
ou.flush();
} catch (IOException e) {
e.printStackTrace();
throw new IOException("复制文件失败!");
} finally {
in.close();
}
}
}