• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Yogesh Gandhi
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out ZipFile.
 
Santosh Kumar Nayak
Ranch Hand
Posts: 143
Eclipse IDE IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only option I see is to iterate through the TarEntries and get the modified time stamp of the entry.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48935
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic