Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Opening a URL-zipfile.

1 view
Skip to first unread message

Piet de Jong

unread,
Dec 21, 1999, 3:00:00 AM12/21/99
to
Hello everyone,

Can anyone tell me how to open a Zipfile from a URL into an InputStream?


Erick Griffin

unread,
Dec 21, 1999, 3:00:00 AM12/21/99
to
Have you tried the java.util.zip class yet..?

Piet de Jong

unread,
Dec 21, 1999, 3:00:00 AM12/21/99
to
Erick Griffin wrote:

Yeah, but the problem is, it's a automatically generated zipfile, so actually
it's a file with extension asp, that I guess I should rename to a .zip-file,
before opening it with the zip-object

Erick Griffin

unread,
Dec 21, 1999, 3:00:00 AM12/21/99
to
Well, I am not so sure the utilities enforce naming, since you
can open the file with the File() constructor and pass that in,
the contents have to be of course in zip format, in order to
use the java.lang.zip class methods...fyi

--Erick

Piet de Jong

unread,
Dec 21, 1999, 3:00:00 AM12/21/99
to Erick Griffin
Would you say the next should be working?

ZipFile zip = new ZipFile(new File("c:\\tmp\\zipfile"));

Because, what I'm getting trying to run this code, is:

java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:69)
at java.util.zip.ZipFile.<init>(ZipFile.java:84)
at Test.main(Test.java:17)

Erick Griffin

unread,
Dec 21, 1999, 3:00:00 AM12/21/99
to
No, haven't seen that one...! Have seen IOException, if there is something
wrong with the file though. Sure the zip file you have was created under
normal conditions and is it formatted right?! ZipExcp means something is
hosed with the file itself!

--erick

Piet de Jong

unread,
Dec 22, 1999, 3:00:00 AM12/22/99
to
>
> Piet de Jong wrote:
>
> > Would you say the next should be working?
> >
> > ZipFile zip = new ZipFile(new File("c:\\tmp\\zipfile"));
> >
> > Because, what I'm getting trying to run this code, is:
> >
> > java.util.zip.ZipException: error in opening zip file
> > at java.util.zip.ZipFile.open(Native Method)
> > at java.util.zip.ZipFile.<init>(ZipFile.java:69)
> > at java.util.zip.ZipFile.<init>(ZipFile.java:84)
> > at Test.main(Test.java:17)
> >
> >

Erick Griffin wrote:

> No, haven't seen that one...! Have seen IOException, if there is something
> wrong with the file though. Sure the zip file you have was created under
> normal conditions and is it formatted right?! ZipExcp means something is
> hosed with the file itself!
>
> --erick

Yeah, well, the zip was created with an Active Server-script, parsing its output in
(Sorry, I never work with ASP, so I do not know how it works exactly, but my guess is
as good as any) zip-valid-format. It's working also, since when I'm downloading the
ASP-zipfile, I can unzip it myself using Winzip 7.0

Piet


Karl Schmidt

unread,
Dec 23, 1999, 3:00:00 AM12/23/99
to
>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<

Am 22.12.99, 07.45.15, schrieb Piet de Jong <pi...@businessnet.net> zum
Thema Re: Opening a URL-zipfile.:

> Erick Griffin wrote:

If you want to open a zip file on an internet server, it's not a file,
but an URL. So you need to open an URLConnection, get the InputStream
from it, and wrap that InputStream in a ZipInputStream. Then you can
access any File inside this ZIP. Wether the source is a 'real' file,
lying physically on the server or if it's generated by some program
doesn't matter.

--
*******************************************************
**** Karl Schmidt Karl_Schmidt at t-online dot de) ****
*** Java related Homepage (under construction): ***
** http://home.t-online.de/home/Karl_Schmidt **
* *
** New: Mastermind with better graphic interface **
*** Message created with StarOffice 5.1 (OS/2) ***
**** Do 23.Dez 99, 03:20:23 ****
*******************************************************

Piet de Jong

unread,
Dec 23, 1999, 3:00:00 AM12/23/99
to
>
> If you want to open a zip file on an internet server, it's not a file,
> but an URL. So you need to open an URLConnection, get the InputStream
> from it, and wrap that InputStream in a ZipInputStream. Then you can
> access any File inside this ZIP. Wether the source is a 'real' file,
> lying physically on the server or if it's generated by some program
> doesn't matter.
>
> --

That's what I'd say, but it DOES, when the zipping-method is not compatible
with your own.


Karl Schmidt

unread,
Dec 24, 1999, 3:00:00 AM12/24/99
to
>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<

Am 23.12.99, 07.49.25, schrieb Piet de Jong <pi...@businessnet.net> zum

Thema Re: Opening a URL-zipfile.:


> >

Of course, but that's a different story :-)

At least you should be able to open the file and check the ZIP
version. Then go ahead and write your own decrompression algorythm...
:-)


0 new messages