.You need to use an additional API (the package java.util.zip) if your application needs to support ZIP compatible files in addition to ordinary files and directories, thereby significantly inflating your code and adding unnecessary complexity (which adds bugs, bugs, and even more bugs). .You can either read or completely write ZIP compatible files, but you cannot just update individual entries. .The classes do not support the concept of a directory, which you may want to create, modify, list or delete. The TrueZIP Library has been developed to overcome these limitations/disadvantages.----------------- 大概看了一下,看到这些的时候好值得期待,似乎确实能解决我这个问题了,先研究研究看看汗,E文太差了,要慢慢吃力的看
TO gtlang78() ( ) 找了一下居然没找到下载的地方,API和exsample都没看到。有个下载链接让我跑到了trueMirror那里去了,把那个trueMirror下载下来,看了一下好象不太明白它那东东
https://truezip.dev.java.net/
The TrueZIP Library has been developed to overcome these limitations/disadvantages.-----------------
大概看了一下,看到这些的时候好值得期待,似乎确实能解决我这个问题了,先研究研究看看汗,E文太差了,要慢慢吃力的看
不过没看到它这方面的应用,看了它的API文档,只有上十来个类的,东西不多。我每个类都看了看,可是没发现相关的增加删除的方法啊,不知该如何实际操作。在网上搜索truezip,中文的没一个资料,英文的也一般都是简介一下,最后的链接还是链到truezip网站了。不知gtlang78() 或哪位老兄研究过这个包没有?
非常感谢!
public static void main(String[] args) throws Exception {
try {
//可以在zip文件中嵌套zip文件。下面最后生成outer.zip文件。
FileOutputStream fos = new FileOutputStream("outer.zip/inner.zip/output.txt");
PrintStream ps = new PrintStream(fos);
ps.println("Creating nested ZIP files is really a no-brainer!");
ps.println(2323);
fos.close();
ps.close();
}
catch (Exception e) {
e.printStackTrace();
}
finally {
File.update();
}
try {
//outer.zip文件中的inner.zip,是作为一个Directory而不是一个File。
File file = new File("outer.zip/inner.zip");
if(file.isFile())
file.delete();
else if(file.isDirectory())
file.deleteAll();
}catch(Exception e) {
e.printStackTrace();
}
}
}