tags:

views:

193

answers:

1

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...

A: 

Hi, 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

Tim van Beek