• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unzip program

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai All,
I want to unzip a zipfile which contain the some
file like , *.tif, *.exe, *.xml, *.ppt, *.rtf
etc...
and I wrote the following code :
ZipFile f= new ZipFile(pathToZipFile) ;
java.util.Enumeration enu = f.entries() ;
while(enu.hasMoreElements()){
ZipEntry entry = (ZipEntry) enu.nextElement() ;
System.out.println("entrys = "+entry.getName());
java.io.InputStream in = f.getInputStream(entry) ;
java.io.FileOutputStream out = new java.io.FileOutputStream(entry.getName() ) ;
for (int ch = in.read(); ch != -1 ; ch = in.read() ) {
out.write(ch) ;
out.close() ;
in.close() ;
}

but it pop up with the following exception :
java.io.IOException: The specified procedure could not be found
I am lokking forward to have a solution.
Greetings,
Nishar.
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try setting the path to where the file should be extracted. something like this:

also, your FOR-loops looks strange, try removing the curly-brace after it, otherwise your while-loop doesn't end, or maybe a typo?
/peter
[ January 10, 2003: Message edited by: Peter Kristensson ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic