Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PROBLEMS WITH java.util.zip.ZipInputStream  class

Posted on 1998-12-10
5
Medium Priority
?
591 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 80 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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 …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses

879 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