TrueZip 创建虚拟目录而不是存档
我遇到以下代码问题:
TFile src = new TFile(this.getMellomStasjon());
TFile dst = new TFile(this.getZipFolder()+""+zipFile+".zip");
if(dst.isDirectory())
dst = new TFile(dst, src.getName());
TFile.cp_rp(src, dst, null);
TFile file = newNonArchiveFile(dst);
if(dst.isArchive())
TFile.umount(dst);
我的目标是使用 TrueZip 将包含文件的目录放入 ZIP 存档中。问题是代码可以在本地运行,但不能在生产计算机上运行。在本地,我得到一个 ZIP 文件,但在生产中,我得到一个文件夹,其中包含我尝试放入存档(虚拟目录)中的文件。我必须使用 TrueZip,因为我要归档超过 4GB 的内容。
有没有办法强制 TrueZip 创建存档而不是(虚拟)目录?
I'm having an issue with the following code:
TFile src = new TFile(this.getMellomStasjon());
TFile dst = new TFile(this.getZipFolder()+""+zipFile+".zip");
if(dst.isDirectory())
dst = new TFile(dst, src.getName());
TFile.cp_rp(src, dst, null);
TFile file = newNonArchiveFile(dst);
if(dst.isArchive())
TFile.umount(dst);
My goal is to put a directory containing files into a ZIP-archive using TrueZip. The problem is that the code works locally but not on the production computer. Locally I get a single ZIP-file, but in production I get a folder containing the files I'm trying to put in the archive (virtual directory). I have to use TrueZip because I'm archiving content over 4GB.
Is there any way to force TrueZip to create an archive instead of a (virtual) directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它可能不起作用,因为运行时类路径上不存在 TrueZIP Driver ZIP 模块的 JAR 工件。
为了确保这一点,您可以通过设置自定义 TArchiveDetector 使 ZipDriver 成为编译时依赖项。这是一个示例: http://truezip.java.net/usecases/aff.html
您在此处显示的代码有问题。您可能应该将其修复为:
It probably didn't work because the JAR artifact of the module TrueZIP Driver ZIP was not present on the run time class path.
To make sure it is, you could make the ZipDriver a compile time dependency by setting a custom TArchiveDetector. Here is an example: http://truezip.java.net/usecases/aff.html
The code you show here is problematic. You should probably fix it to:
找到了 Apache 的替代库,Commons Compression。使用它代替 TrueZip。似乎也支持 >4GB 文件。
Found an alternative library by Apache, Commons Compression. Using it instead of TrueZip. Seems to support >4gb files as well.