0

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

carlspring
  • 31,231
  • 29
  • 115
  • 197
  • 1
    You have a link to the relevant documentation? Have you tried anything? – Atreys Jul 29 '11 at 14:04
  • Well, `compareTo` and `equals` are not what I'm looking for. I have the javadocs locally (downloaded as Maven dependencies). Both methods compare the paths instead of the contents/sizes. – carlspring Jul 29 '11 at 14:06

1 Answers1

1

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);
}
Derek 朕會功夫
  • 92,235
  • 44
  • 185
  • 247
Christian Schlichtherle
  • 3,125
  • 1
  • 23
  • 47