wood burning stoves*
The moose likes Java in General and the fly likes Getting info from a file inside an ear/war file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Getting info from a file inside an ear/war file." Watch "Getting info from a file inside an ear/war file." New topic
Author

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

Jeff Strike
Greenhorn

Joined: May 19, 2008
Posts: 15
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
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Jeff Strike
Greenhorn

Joined: May 19, 2008
Posts: 15
Sweet. I never saw ZipInputStream.

Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting info from a file inside an ear/war file.
 
Similar Threads
Is it possible to create an eclipse project from an existing EAR file?
how to merge war file and ear file?
Problem in deploying ear file in weblogic 6.1
What's the point of an ear file?
Loading multiple log4j.xml files