File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes View file from inside zip? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "View file from inside zip?" Watch "View file from inside zip?" New topic

View file from inside zip?

Max Power
Ranch Hand

Joined: May 10, 2004
Posts: 47
Hello, is it somehow possible to view a file from inside a zip file?
Here is my code:

Do I need to unpack the file before reading?

Petr Blahos
Ranch Hand

Joined: Apr 28, 2004
Posts: 131

Why don't you use ZipInputStream?
ZipEntry ze = (ZipEntry)entries.nextElement();
InputStream is = zipfile.getInputStream(ze);

But technically the file will be unpacked before viewing ;-)

Best regards,

Get a better web browser:<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: View file from inside zip?
It's not a secret anymore!