This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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!