本文整理汇总了Java中java.util.zip.ZipEntry.getLastModifiedTime方法的典型用法代码示例。如果您正苦于以下问题:Java ZipEntry.getLastModifiedTime方法的具体用法?Java ZipEntry.getLastModifiedTime怎么用?Java ZipEntry.getLastModifiedTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.zip.ZipEntry
的用法示例。
在下文中一共展示了ZipEntry.getLastModifiedTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cloneEntry
import java.util.zip.ZipEntry; //导入方法依赖的package包/类
private ZipEntry cloneEntry(ZipEntry entry) {
ZipEntry newEntry = new ZipEntry(entry.getName());
newEntry.setTime(entry.getTime());
if (entry.getCreationTime() != null) {
newEntry.setCreationTime(entry.getCreationTime());
}
if (entry.getLastModifiedTime() != null) {
newEntry.setLastModifiedTime(entry.getLastModifiedTime());
}
if (entry.getLastAccessTime() != null) {
newEntry.setLastAccessTime(entry.getLastAccessTime());
}
newEntry.setComment(entry.getComment());
newEntry.setExtra(entry.getExtra());
return newEntry;
}
示例2: testTimeConversions
import java.util.zip.ZipEntry; //导入方法依赖的package包/类
static void testTimeConversions(long from, long to, long step) {
ZipEntry ze = new ZipEntry("TestExtraTime.java");
for (long time = from; time <= to; time += step) {
ze.setTime(time);
FileTime lastModifiedTime = ze.getLastModifiedTime();
if (lastModifiedTime.toMillis() != time) {
throw new RuntimeException("setTime should make getLastModifiedTime " +
"return the specified instant: " + time +
" got: " + lastModifiedTime.toMillis());
}
if (ze.getTime() != time) {
throw new RuntimeException("getTime after setTime, expected: " +
time + " got: " + ze.getTime());
}
}
}