Solved

PROBLEMS WITH java.util.zip.ZipInputStream  class

Posted on 1998-12-10
5
576 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Suggested Courses

738 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