简体   繁体   中英

How can you get the size of a file in an archive using TrueZip?

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

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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM