problem with zipinputstream class
here is a code written to connect to a password protected url and
also to see the contents of that site.
the url listed in the code contains a zip file(content type application/x-gzip)
i have connected to that site through URLConnection class and created a
ZipInputStream to print name of each zipEntry in that file but the program
prints the content type and content length and comes out it doesnt print
the list of files in that zip archive.
please any body help me
(if u want to connect to that site
for verification please type this url in the address bar of u r browser
thanks in advance
public static void main(String args)
/* BufferedReader bo=new BufferedReader(new InputStreamReader(System.in));
System.out.println("entet the url");
URL u=new URL(url);
String compress= userid+":"+passwd;
String encoding=new sun.misc.BASE64Encoder().encode(compress.getBytes());
URLConnection uc= u.openConnection();
InputStream in1= (InputStream)uc.getInputStream();
ZipInputStream in=new ZipInputStream(in1);
/* getNextEntry() method reads the next ZIP file entry and
positions stream at the beginning of the entry data and returns
Re: problem with zipinputstream class
Fortunately the URL is not actually password-protected, so I could download
the file. It isn't exactly a zip file; I tried to open it with WinZip and
it said "Archive contains one file: 2000-10-16-tocs.tar Should WinZip
decompress it to a temporary folder and open it?". So it only contains one
file, and that's a Unix tar-format archive file that contains many files.
Why don't you download the file and see if you can get the ZipInputStream to
work from your local hard drive? Right now you are testing URLConnection
and ZipInputStream at the same time, and it's always better to test only one
thing at a time.
dinesh <email@example.com> wrote in message
> hi everybody:
> here is a code written to connect to a password protected url and
> also to see the contents of that site.
> the url listed in the code contains a zip file(content type
> i have connected to that site through URLConnection class and created a
> ZipInputStream to print name of each zipEntry in that file but the program
> prints the content type and content length and comes out it doesnt print
> the list of files in that zip archive.
> please any body help me
> (if u want to connect to that site
> for verification please type this url in the address bar of u r browser
> thanks in advance
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL