📄 util.java
字号:
/*
* 创建日期 2005-10-25
*
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
package javazip.util;
import java.io.File;
/**
* @author dragon
*
* TODO 要更改此生成的类型注释的模板,请转至 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
public class Util {
CompressUtil util;
public final int ZIP = 1;
public final int GZIP = 2;
public final int JAR = 3;
private String comment;
public int curType = ZIP;
/**
*
* @param list
* @param target
*/
public void compressFile(File list[], String target) {
if (curType == ZIP) {
ZipUtil util = new ZipUtil();
util.setComment(comment);
util.compressFile(list, target);
} else if (curType == GZIP) {
util = new GzipUtil();
util.compressFile(list, target);
} else if (curType == JAR) {
util = new JarUtil();
util.compressFile(list, target);
} else {
util = new ZipUtil();
util.compressFile(list, target);
}
}
/**
*
* @param source
* @param target
*/
public void extractFile(String source, String target) {
if (source.endsWith(".zip")) {
ZipUtil util = new ZipUtil();
util.extractFile(source, target);
} else if (source.endsWith(".gz")) {
util = new GzipUtil();
util.extractFile(source, target);
} else if (source.endsWith(".jar")) {
util = new JarUtil();
util.extractFile(source, target);
} else {
}
}
/**
*
* @param f
* @return
*/
public boolean testFile(File f) {
String source = f.toString();
if (source.endsWith(".zip")) {
util = new ZipUtil();
return util.testFile(f);
} else if (source.endsWith(".gz")) {
util = new GzipUtil();
return util.testFile(f);
} else if (source.endsWith(".jar")) {
util = new JarUtil();
return util.testFile(f);
} else {
}
return true;
}
/**
*
* @return
*/
public String getComment() {
return comment;
}
/**
*
* @param comment
*/
public void setComment(String comment) {
this.comment = comment;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -