• 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

Getting info from a file inside an ear/war file.

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have several war files inside an ear.
I need to get info from the mainifest file inside each war file.

I can open the ear file and find the war file entries easy enough with the ZipFile class, but is it possible to open the manifest.mf inside each war file without first unpacking the war from the ear?

Thanks,
-Jeff
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can call the ZipFile's getInputStream(ZipEntry) method. This returns a raw input stream for that entry only. You can then wrap that input stream into a ZipInputStream:
Note how I simply read from the ZipInputStream. That's how ZipInputStream works; after each call to getNextEntry(), the ZipInputStream is reset to start reading from that entry only.
 
Jeff Strike
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sweet. I never saw ZipInputStream.

Thanks!
reply
    Bookmark Topic Watch Topic
  • New Topic