Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Creating Zip with streams vs. files: problems reading with WinRAR and Java ZipInputStream

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20398 |

    I have been using Xceed.Zip to create zip files from streams for some years. After upgrading to version 4.2, clients were unable to read my Xceed-created-zip-files with the java ZipInputStream class. Their symptom is that the zip file appears to have only 1 entry.

    Interesting items to note:

    – When troubleshoot this, I noted that WinRAR reads the files correctly, but using WinRAR Tools > Repair Archive function exhibits the same symptoms: the “repaired” zip file has just one entry.

    – When attempting to read the Xceed-created-zip-files using the java ZipFile class, all works well

    – When creating the Xceed-created-zip-files under Xceed.Zip 2.0.113.0, all works well

    – When creating the zip files using the Xceed 4.2 front end, the “one file problem” exists

    – When creating the zip files using the Xceed 4.3 front end, all works well

    – When creating the zip files using Xceed 4.3 (trial version) and streams, the “one file problem” exists 

    – There was a java bug that was fixed years ago: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4635869

    Does anyone have any suggestions for guaranteeing readability with the widely used ZipInputSteam class?

     

     

     

    Imported from legacy forums. Posted by Eric (had 1944 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Eric, 

     # Zip.NET 4.2 has the exact same features as v4.1 but uses new storage engine to greatly reduce the number of temporary files. Faster with large operations but the engine is new and complex so bugs could be present. This version is obsolete and should not be used. Use v4.3 instead.


    # Zip.NET 4.3 Improvements on v4.2 to fix many bugs and add small niche features. Recommended for use in production code.

    So what’s the problem then? 

    Imported from legacy forums. Posted by Michel [Xceed] (had 156 views)

    User (Old forums)
    Member
    Post count: 23064

    Michel,

    The problem is that ZIP files with multiple files created via a stream with in Zip.NET  4.x cannot be processed by standard Java code.

    This problem has been demonstrated in Java 1.5 through 1.6.

    These same/similar stream code in Zip.NET 2.0 creates files that can be process by standard Java code

    WinRAR also reports the problems when a Repair is done.

    I have a short Java application and  sample ZIP files build with 4.3 that demonstrate the problem.

    If you send me an email and I can forward you the files.

    The meat of the demonstration Java code is the following:

    /* This works in that it lists all files in the ZIP */

    ZipFile zipFile = new ZipFile(theFile);

    Enumeration zipEntries = zipFile.entries();

    ZipEntry ze;

    while (zipEntries.hasMoreElements())

    {

    ze = (ZipEntry)zipEntries.nextElement();

    System.out.println(ze.getName() + ”  [” + ze.getSize() + “]”);

    }

    zipFile.close(); 

    /* This fails in that it only lists the first file in the ZIP */

    FileInputStream fis = new FileInputStream(theFile);

    ZipInputStream zis = new ZipInputStream(fis);

    ZipEntry ze;

    ze = zis.getNextEntry();

    while (ze != null)

    {

    System.out.println(ze.getName() + ”  [” + ze.getSize() + “]”);

    zis.closeEntry();

    ze = zis.getNextEntry();

    }

    zis.close();

    fis.close();

     

    Regards,

    Kevin 

     

     

     

     

     

     

     

     

    Imported from legacy forums. Posted by kevin (had 1639 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.