|
@@ -1,8 +1,6 @@
|
|
|
package com.qmth.boot.tools.io;
|
|
|
|
|
|
import com.sun.istack.internal.NotNull;
|
|
|
-import com.sun.istack.internal.Nullable;
|
|
|
-import org.apache.commons.lang3.ArrayUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import java.io.*;
|
|
@@ -66,23 +64,14 @@ public class ZipWriter {
|
|
|
}
|
|
|
|
|
|
|
|
|
- * 使用本地文件增加ZIP内部文件,dir表示完整的内部路径,可以为空;不指定内部文件名时,直接使用本地文件名
|
|
|
+ * 使用本地文件增加ZIP内部文件,path包括完整的内部路径,至少包含内部文件名
|
|
|
*
|
|
|
* @param file
|
|
|
- * @param name
|
|
|
- * @param dir
|
|
|
+ * @param path
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
- public void write(@NotNull File file, @Nullable String name, @Nullable String... dir) throws IOException {
|
|
|
- if (name == null) {
|
|
|
- name = file.getName();
|
|
|
- }
|
|
|
- if (dir == null || dir.length == 0) {
|
|
|
- dir = new String[] { name };
|
|
|
- } else {
|
|
|
- dir = ArrayUtils.add(dir, name);
|
|
|
- }
|
|
|
- write(new FileInputStream(file), dir);
|
|
|
+ public void write(@NotNull File file, @NotNull String... path) throws IOException {
|
|
|
+ write(new FileInputStream(file), path);
|
|
|
}
|
|
|
|
|
|
|