Solved

PROBLEMS WITH java.util.zip.ZipInputStream  class

Posted on 1998-12-10
5
572 Views
Last Modified: 2008-02-20
Hello...
I am having a problem when I unzip a file with java.util.zip.ZipInputStream class
the error is "invalid compression method"
but when I unzip the same file using winzip, I don't have this problem...
Is there another version of this class that I can use or another way to unzip this file?

thanks


0
Comment
Question by:dorock
  • 3
5 Comments
 
LVL 8

Expert Comment

by:diakov
ID: 1229162
Lets clarify. The zip package can unzip only files produced by it self. Is this the case?

Nik.
0
 

Author Comment

by:dorock
ID: 1229163
>Lets clarify. The zip package can unzip only files produced by >it self. Is this the case?
>Nik.
No Nik, I can unzip others files produced by others programs...
I think the problem is that this file uses an older compressiom method...

0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1229164
>>    I think the problem is that this file uses an older compressiom method...
maybe yes ...

can you send me example .zip file (heyhey@nettaxi.com)
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1229165
hi, dorock,

Did you receive my letter. If you like my answer, I can post it here. If you are not satisfied you can very easy delete the question ...

best regards
  heyhey
0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 20 total points
ID: 1229166
i tried your .zip file, and of course i received
   java.lang.InternalError: invalid compression method
after some researching i found that your zip file is compressed with IMPLODE method

 Length  Method   Size  Ratio   Date    Time    CRC-32  Attr  Name
 ------  ------   ----- -----   ----    ----   -------- ----  ----
 403744  Implode  42336  90%  12-14-98  18:31  c44757bf --w-  BDIN
 ------          ------  ---                                  -------
 403744           42336  90%                                        1

 and java.util.zip (at least in JDK 1.1.6) supports only DEFLATED and STORED methods ...


switch (entry.method) {
case DEFLATED:
    len = super.read(b, off, len);
// ....
    return len;
case STORED:
    if (remaining <= 0)
//    ....
    return len;
default:
    throw new InternalError("invalid compression method");


i just don't have time to check in my books what are the differences between these methods (as far as i remember there are
3/4/5 types of
codeing in .zip files) ... and if some of the are not used nowadays ...
but it seems that DEFLATED compression is better than IMPLODE

your zip is
42422 bytes IMPLODED
40030 bytes DEFLATED

so i suppose that DEFLATE is some older - not so effective - method ...
maybe you've used too old Zip utility when you've packed the zip file ?

that's all for now
if you have more questions, please post them ...

0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Application launch issue with Apache Tomcat 5 43
topping3 challenge 14 79
java 8 lambda expresssions exception handling 3 89
couple of eclipse 5 36
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question