Home arrow static arrow Java Programming [Archive] - ZipInputStream
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - ZipInputStream
This topic has 2 replies on 1 page.

Posts:2
Registered: 3/23/01
ZipInputStream  
Aug 5, 2004 5:46 AM



 
Hi,

I am trying to read a file from a zip file and i felt there is no better way to handle this than by handling it like below code.

InputStream iss = getClass().getResourceAsStream("A.zip");
ZipInputStream zis = new ZipInputStream(iss);
ZipEntry entry = zis.getNextEntry();
InputStream is = getClass().getResourceAsStream(entry.getName());

Is this a better way to get an InputStream from the entry.

Thanks
Ajay

 

Posts:19,725
Registered: 9/26/01
Re: ZipInputStream  
Aug 5, 2004 5:50 AM (reply 1 of 2)



 
getNextEntry() positions your stream at the beginning of the next entry within the zip. Just read the first stream from there -- why are you trying to create yet another stream when you already have one?
 

Posts:2
Registered: 3/23/01
Re: ZipInputStream  
Aug 5, 2004 10:27 PM (reply 2 of 2)



 
I am trying to read the inputstream of the first entry.
 
This topic has 2 replies on 1 page.