-
Class to process zip files (7 messages)
- Posted by: Nestor Boscan
- Posted on: March 01 2007 22:34 EST
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)
- Re: Class to process zip files by L H on March 02 2007 04:36 EST
- Re: Class to process zip files by Nestor Boscan on March 03 2007 21:33 EST
- Re: Class to process zip files by Nestor Boscan on March 03 2007 10:16 EST
-
Re: Class to process zip files by Emil Kirschner on March 06 2007 06:02 EST
-
Re: Class to process zip files by Emil Kirschner on March 06 2007 06:05 EST
- Re: Class to process zip files by Alex Krenvalk on October 25 2009 08:06 EDT
-
Re: Class to process zip files by Emil Kirschner on March 06 2007 06:05 EST
- Re: Class to process zip files by Nestor Boscan on March 03 2007 21:33 EST
- Or by Ben Wilcock on March 02 2007 05:43 EST
-
Re: Class to process zip files[ Go to top ]
- Posted by: L H
- Posted on: March 02 2007 04:36 EST
- in response to Nestor Boscan
Why not use java.util.zip.ZipInputStream from the JDK? -
Re: Class to process zip files[ Go to top ]
- Posted by: Nestor Boscan
- Posted on: March 03 2007 21:33 EST
- in response to L H
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 -
Re: Class to process zip files[ Go to top ]
- Posted by: Nestor Boscan
- Posted on: March 03 2007 22:16 EST
- in response to Nestor Boscan
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. -
Re: Class to process zip files[ Go to top ]
- Posted by: Emil Kirschner
- Posted on: March 06 2007 06:02 EST
- in response to Nestor Boscan
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 -
Re: Class to process zip files[ Go to top ]
- Posted by: Emil Kirschner
- Posted on: March 06 2007 06:05 EST
- in response to Emil Kirschner
this example uses JarFile, but you can use ZipFile/ZipEntry instead, it works exactly the same. Emil. -
Re: Class to process zip files[ Go to top ]
- Posted by: Alex Krenvalk
- Posted on: October 25 2009 08:06 EDT
- in response to Emil Kirschner
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-corrupt zip files recovery software.Software solved my problem easy and for free. -
Or[ Go to top ]
- Posted by: Ben Wilcock
- Posted on: March 02 2007 05:43 EST
- in response to Nestor Boscan
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