summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/util')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java4
-rw-r--r--src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java28
-rw-r--r--src/main/java/com/keuin/kbackupfabric/util/ZipUtilException.java2
3 files changed, 16 insertions, 18 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java b/src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java
index e76155f..8c8a687 100644
--- a/src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java
+++ b/src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java
@@ -17,8 +17,8 @@ public final class PrintUtil {
private static final Object syncInfo = new Object();
private static final Object syncMessage = new Object();
- public static CommandContext<ServerCommandSource> message(CommandContext<ServerCommandSource> context, String messageText) {
- return message(context, messageText, false);
+ public static void message(CommandContext<ServerCommandSource> context, String messageText) {
+ message(context, messageText, false);
}
public static CommandContext<ServerCommandSource> message(CommandContext<ServerCommandSource> context, String messageText, boolean broadcastToOps) {
diff --git a/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java b/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java
index 1ceeb60..fec4436 100644
--- a/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java
+++ b/src/main/java/com/keuin/kbackupfabric/util/ZipUtil.java
@@ -43,7 +43,7 @@ public final class ZipUtil {
else {
// 压缩目录中的文件或子目录
File[] childFileList = file.listFiles();
- if(childFileList != null) {
+ if (childFileList != null) {
for (File value : childFileList)
zip(srcRootDir, value, zos);
}
@@ -56,7 +56,7 @@ public final class ZipUtil {
* @param srcPath 要压缩的源文件路径。如果是目录,则将递归压缩这个目录及其所有子文件、子目录树。
* @param zipPath 压缩文件保存的路径。注意:zipPath不能是srcPath路径下的子文件夹
* @param zipFileName 压缩文件名
- * @throws IOException IO Error
+ * @throws IOException IO Error
* @throws ZipUtilException General exception, such as loop recursion or invalid input.
*/
public static void zip(String srcPath, String zipPath, String zipFileName) throws IOException, ZipUtilException {
@@ -76,8 +76,8 @@ public final class ZipUtil {
//判断压缩文件保存的路径是否存在,如果不存在,则创建目录
File zipDir = new File(zipPath);
if (!zipDir.exists() || !zipDir.isDirectory()) {
- if(!zipDir.mkdirs()) {
- throw new IOException(String.format("Failed to make directory tree %s",zipDir.toString()));
+ if (!zipDir.mkdirs()) {
+ throw new IOException(String.format("Failed to make directory tree %s", zipDir.toString()));
}
}
@@ -89,8 +89,8 @@ public final class ZipUtil {
SecurityManager securityManager = new SecurityManager();
securityManager.checkDelete(zipFilePath);
//删除已存在的目标文件
- if(!zipFile.delete()) {
- throw new IOException(String.format("Failed to delete existing file %s",zipFile.toString()));
+ if (!zipFile.delete()) {
+ throw new IOException(String.format("Failed to delete existing file %s", zipFile.toString()));
}
}
@@ -143,8 +143,8 @@ public final class ZipUtil {
// 创建解压缩文件保存的路径
File unzipFileDir = new File(unzipFilePath);
if (!unzipFileDir.exists() || !unzipFileDir.isDirectory()) {
- if(!unzipFileDir.mkdirs())
- throw new IOException(String.format("Failed to make directory tree %s",unzipFileDir.toString()));
+ if (!unzipFileDir.mkdirs())
+ throw new IOException(String.format("Failed to make directory tree %s", unzipFileDir.toString()));
}
// 开始解压
@@ -173,8 +173,8 @@ public final class ZipUtil {
entryDir = new File(entryDirPath);
// 如果文件夹路径不存在,则创建文件夹
if (!entryDir.exists() || !entryDir.isDirectory()) {
- if(!entryDir.mkdirs())
- throw new IOException(String.format("Failed to make directory tree %s",entryDir.toString()));
+ if (!entryDir.mkdirs())
+ throw new IOException(String.format("Failed to make directory tree %s", entryDir.toString()));
}
// 创建解压文件
@@ -184,13 +184,13 @@ public final class ZipUtil {
SecurityManager securityManager = new SecurityManager();
securityManager.checkDelete(entryFilePath);
// 删除已存在的目标文件
- if(!entryFile.delete())
- throw new IOException(String.format("Failed to delete existing file %s",entryFile.toString()));
+ if (!entryFile.delete())
+ throw new IOException(String.format("Failed to delete existing file %s", entryFile.toString()));
}
if (entry.isDirectory()) {
// If the entry is a directory, we make its corresponding directory.
- if(!entryFile.mkdir())
- throw new IOException(String.format("Failed to create directory %s",entryFile.toString()));
+ if (!entryFile.mkdir())
+ throw new IOException(String.format("Failed to create directory %s", entryFile.toString()));
} else {
// Is a file, we write the data
// 写入文件
diff --git a/src/main/java/com/keuin/kbackupfabric/util/ZipUtilException.java b/src/main/java/com/keuin/kbackupfabric/util/ZipUtilException.java
index 85bfec5..b31272d 100644
--- a/src/main/java/com/keuin/kbackupfabric/util/ZipUtilException.java
+++ b/src/main/java/com/keuin/kbackupfabric/util/ZipUtilException.java
@@ -1,8 +1,6 @@
package com.keuin.kbackupfabric.util;
public class ZipUtilException extends Exception {
- private static final long serialVersionUID = 1L;
-
public ZipUtilException() {
}