How can you get the size of a file in an archive u

2019-03-06 08:34发布

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?

Thanks in advance,

Martin

标签: java truezip
1条回答
叼着烟拽天下
2楼-- · 2019-03-06 09:31

First, call the method TFile.umount() to commit any changes.

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);
}
查看更多
登录 后发表回答