Solved

PROBLEMS WITH java.util.zip.ZipInputStream  class

Posted on 1998-12-10
5
581 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

734 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