开发者

TrueZip Recursive Unzipping?

Does anyone have experience with the TrueZip java library? I'm trying to do what should be a simple task, unzipping an archive that contains subfolders, and I've so far been unable to get it to work.

(The reason I'm using TrueZip is because of the encoding foreign character bug in the java.util.zip methods)

Looking at the API, it seems that file.archiveCopyAllTo() is their "unzip" method. However, the below code only works if my archive is flat and contains only files. It fails if there's any subfolders.

private static void testUnzip(String zipPath, File unzipFolder) 
{
    de.schlichtherle.io.File zipFile = new de.schlichtherle.io.File(zipPath);
    boolean result = zipFile.archiveCopyAllTo(unzipFolder);
    System.out.println("UNZIP RESULT: " + result);
}

Or if anyone knows开发者_如何转开发 a different means to unzip archives with possible non-ASCII characters in the filenames, that would be great too... thanks!

EDIT: I've given up on using TrueZIP. I was able to use org.apache.tools.zip to extract files with non-ASCII characters in the filenames. That API makes more sense to me also...


in my application I had to add

de.schlichtherle.io.File.umount(zipFile);

as the last statement to see the result, it seems that (at least some version of) truezip caches the whole zip and writes it to disc only during the umount method.

HTH

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜