This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to read timestamp of a file present inside a ZIP/JAR/WAR file in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to read timestamp of a file present inside a ZIP/JAR/WAR file in java?" Watch "How to read timestamp of a file present inside a ZIP/JAR/WAR file in java?" New topic
Author

How to read timestamp of a file present inside a ZIP/JAR/WAR file in java?

Yogesh Gandhi
Ranch Hand

Joined: Dec 05, 2008
Posts: 218
I have a ZIP file, which has multiple files...

I want to know, the timestamp of a particular file present inside the ZIP file.

One way is, I have to iterate over all the present files that are present in the ZIP file and then I can get..

Is there any other better way to do that..??

One way is given at

http://www.thecoderscorner.com/team-blog/java-and-jvm/12-reading-a-zip-file-from-java-using-zipinputstream

Any better and efficient method... because I might neeed to read 50 files.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19848
    
  20

Check out ZipFile.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Santosh Kumar Nayak
Ranch Hand

Joined: Aug 02, 2011
Posts: 114
Is there an efficient way to read time stamp of file in tar File format.

For example : Tar file has multiple files in it and I want to read the last modified timestamp for a file.
vijay kumar nara
Greenhorn

Joined: Jan 12, 2015
Posts: 1
The only option I see is to iterate through the TarEntries and get the modified time stamp of the entry.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40490
    
  28
Welcome to the Ranch
 
Don't get me started about those stupid light bulbs.
 
subject: How to read timestamp of a file present inside a ZIP/JAR/WAR file in java?