1、修改jar分片上传功能
2、添加编译测试环境镜像文件
This commit is contained in:
@ -25,7 +25,9 @@ import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.ForkJoinTask;
|
||||
import java.util.concurrent.RecursiveTask;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class IoUtils {
|
||||
|
||||
private final static Charset charset=Charset.forName("UTF-8");
|
||||
@ -237,6 +239,44 @@ public class IoUtils {
|
||||
fos.flush();
|
||||
closeQuietly(fos);
|
||||
}
|
||||
|
||||
public static void delete(File file) {
|
||||
delete(file, false);
|
||||
}
|
||||
|
||||
public static void delete(File file,boolean all) {
|
||||
if(all) {
|
||||
if(file.isDirectory()) {
|
||||
File[] childs = file.listFiles();
|
||||
if(childs!=null) {
|
||||
for (int i = 0; i < childs.length; i++) {
|
||||
if(childs[i].isDirectory()) {
|
||||
delete(childs[i],all);
|
||||
}else {
|
||||
if(!childs[i].delete()) {
|
||||
log.warn("文件【"+childs[i].getName()+"】删除失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!file.delete()) {
|
||||
log.warn("文件【"+file.getName()+"】删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void stringToFile(String content, File file) throws IOException {
|
||||
if (!file.exists()) {
|
||||
//createDirectory(file.getParentFile());
|
||||
file.createNewFile();// 将压缩文件内容写入到这个文件中
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
fos.write(content.getBytes(charset));
|
||||
fos.flush();
|
||||
closeQuietly(fos);
|
||||
}
|
||||
|
||||
public static void writeFile(File file, OutputStream out, boolean close) throws IOException {
|
||||
FileInputStream in = null;
|
||||
|
||||
Reference in New Issue
Block a user