General J2EE: Class to process zip files

  1. Class to process zip files (7 messages)

    Hi Is there an open source library that can help me unzip an InputStream that contains a zip doument and obtain an InputStream for each file inside the zip?.

    Threaded Messages (7)

  2. Re: Class to process zip files[ Go to top ]

    Why not use java.util.zip.ZipInputStream from the JDK?
  3. Re: Class to process zip files[ Go to top ]

    Thanks for the reply But I'm having problems with this approach. If I do: input = new ZipInputStream (file.getInputStream ()); while ((entry = input.getNextEntry ()) != null) { content = new byte [(int) entry.getSize ()]; input.read (content); output = new FileOutputStream (file.getName ()); output.write (content); output.close (); } I'm not getting the same files
  4. Re: Class to process zip files[ Go to top ]

    It seems that you have to use ZipInputStream in a very specific way to make it work. Also there is a bug since JDK 1.4 that the class will throw an exception if it finds UTF character in the file names.
  5. Re: Class to process zip files[ Go to top ]

    here's an example that shows how to read from a zip entry: ================================= jarFile = new JarFile("file.zip"); JarEntry jarEntry = jarFile.getJarEntry("file/in/archive.txt"); InputStream is = jarFile.getInputStream(jarEntry); ================================= if you read from the input you'll get the right content. hope this helps. Emil Kirschner
  6. this example uses JarFile, but you can use ZipFile/ZipEntry instead, it works exactly the same. Emil.
  7. Re: Class to process zip files[ Go to top ]

    I usually use for work with zip files different tools.But once some important zip archives were damaged.And no one of these tools couldn't help me.And a friend recommended to me-[url=http://www.recoverytoolbox.com/recovery_zip_files.html]corrupt zip files recovery software[/url].Software solved my problem easy and for free.
  8. Or[ Go to top ]

    Or perhaps Jakarta Commons Compress? http://jakarta.apache.org/commons/sandbox/compress/ It is sandbox though, so the first suggestion is probably better? Ben http://www.benwilcock.net