File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 19541
    
  16

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
What's the point of an ear file?
Loading multiple log4j.xml files
how to merge war file and ear file?
Problem in deploying ear file in weblogic 6.1
Is it possible to create an eclipse project from an existing EAR file?