Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger


Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a zip file which comes from DB as a blob and I need to check the contents of the files after unzipping.The checks I need to make are..
1) The zip file should not contain more than one file in it
2)The file inside the zip file should be in a particular extension( like .xml or xls).
Am using servlets to get the data from the DB perform all these operations.
Any inputs as to how to procees will be helpful
Ranch Hand
Posts: 15304
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems to me that you have the Servlet part already figured out. So I think I will move this to the IO and Streams forum so those experts can handle your specific needs regarding Zipped files, extensions, etc.
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mary !
the following shows how to unzip the a zip file, get the file names etc. It will help you.the classes you need are in*;
when you get the zip file from the DB,create a zip file as follows:
ZipFile zipfile = new Zipfile(filename);
then: get the entries in the zip file:
Enumeration entries = zipfile.entries();
then you can go through all of them
//get the entry
ZipEntry entry = (ZipEntry)entries.nextElement();
//get file name
String name = entry.getName();

//parse the name
StringTokenizer st = new StringTokenizer(name,".");
----- so on-----
}//end while
Hope that helps

Arthur, where are your pants? Check under this tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic