java.util.zip.ZipEntry.getLastAccessTime()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中java.util.zip.ZipEntry.getLastAccessTime()方法的一些代码示例,展示了ZipEntry.getLastAccessTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipEntry.getLastAccessTime()方法的具体详情如下:
包路径:java.util.zip.ZipEntry
类名称:ZipEntry
方法名:getLastAccessTime

ZipEntry.getLastAccessTime介绍

暂无

代码示例

代码示例来源:origin: zeroturnaround/zt-zip

public void setTime(ZipEntry newInstance, ZipEntry oldInstance) {
 {
  FileTime time = oldInstance.getCreationTime();
  if (time != null) {
   newInstance.setCreationTime(time);
  }
 }
 {
  FileTime time = oldInstance.getLastModifiedTime();
  if (time != null) {
   newInstance.setLastModifiedTime(time);
  }
 }
 {
  FileTime time = oldInstance.getLastAccessTime();
  if (time != null) {
   newInstance.setLastAccessTime(time);
  }
 }
}

代码示例来源:origin: google/bundletool

public ZipEntrySubject withoutTimestamp() throws IOException {
 assertWithMessage("File \"%s\" in zip file has no creation time set", actual())
   .that(actual().getCreationTime())
   .isNull();
 assertWithMessage("File \"%s\" in zip file has no last access time set", actual())
   .that(actual().getLastAccessTime())
   .isNull();
 // Zip files internally use extended DOS time.
 assertWithMessage("File \"%s\" in zip file does not have the expected time", actual())
   .that(fromLocalTimeToUtc(actual().getTime()))
   .isEqualTo(EXTENDED_DOS_TIME_EPOCH_START_TIMESTAMP);
 return this;
}

代码示例来源:origin: com.github.bloodshura/shurax

@Nonnull
public Instant getLastAccessTime() {
  return getHandle().getLastAccessTime().toInstant();
}

代码示例来源:origin: com.github.bloodshura/ignitium-core

@Nonnull
public Instant getLastAccessTime() {
  return getHandle().getLastAccessTime().toInstant();
}

代码示例来源:origin: wildfly/wildfly-core

private static void unzip(final ZipFile zip, final Path targetDir) throws IOException {
  final Enumeration<? extends ZipEntry> entries = zip.entries();
  while (entries.hasMoreElements()) {
    final ZipEntry entry = entries.nextElement();
    final String name = entry.getName();
    final Path current = resolveSecurely(targetDir, name);
    if (entry.isDirectory()) {
      if (!Files.exists(current)) {
        Files.createDirectories(current);
      }
    } else {
      if (Files.notExists(current.getParent())) {
        Files.createDirectories(current.getParent());
      }
      try (final InputStream eis = zip.getInputStream(entry)) {
        Files.copy(eis, current);
      }
    }
    try {
      Files.getFileAttributeView(current, BasicFileAttributeView.class).setTimes(entry.getLastModifiedTime(), entry.getLastAccessTime(), entry.getCreationTime());
    } catch (IOException e) {
      //ignore, if we cannot set it, world will not end
    }
  }
}

代码示例来源:origin: docbleach/DocBleach

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;
 }
}

代码示例来源:origin: org.zeroturnaround/zt-zip

public void setTime(ZipEntry newInstance, ZipEntry oldInstance) {
 {
  FileTime time = oldInstance.getCreationTime();
  if (time != null) {
   newInstance.setCreationTime(time);
  }
 }
 {
  FileTime time = oldInstance.getLastModifiedTime();
  if (time != null) {
   newInstance.setLastModifiedTime(time);
  }
 }
 {
  FileTime time = oldInstance.getLastAccessTime();
  if (time != null) {
   newInstance.setLastAccessTime(time);
  }
 }
}

相关文章