如何使用TrueZip获取档案中文件的大小? [英] How can you get the size of a file in an archive using TrueZip?
本文介绍了如何使用TrueZip获取档案中文件的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
根据TrueZip文档,length()
方法似乎返回0或-1.
我正在更新WAR存档,我只想更新其长度已更改的文件.如何实现?
As per the TrueZip docs, it appears that the length()
method returns 0 or -1.
I am updating a WAR archive and I would like to only update files whose lengths have changed. How can this be achieved?
预先感谢
马丁
推荐答案
首先,调用方法TFile.umount()
提交所有更改.
First, call the method TFile.umount()
to commit any changes.
然后使用以下方法获取未检测到存档文件的TFile并调用其length()方法:
Then use the following method to obtain a TFile which does not detect the archive file and call its length() method:
private static TFile newNonArchiveFile(TFile file) {
return new TFile(file.getParentFile(), file.getName(), TArchiveDetector.NULL);
}
这篇关于如何使用TrueZip获取档案中文件的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文